- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1401 Articles for C
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
283 Views
The character type data is stored by its ASCII value internally in C or C++. If we want to print a single character as integer, we will get the ASCII value. But when we are trying to print more than one character using a single quote, then it will print some strange output.Please check the following program to get the idea.Example#include int main() { printf("%d", 'A'); printf("%d", 'AA'); printf("%d", 'ABC'); }Output65 16705 4276803The ASCII of A is 65. So at first it is showing 65 (01000001). Now for AA, it is showing 16705. This is ASCII ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
3K+ Views
In C or C++, the variables are stored into memory, so we can get their memory addresses. Similarly, the functions also are stored into the memory, so they also have some addresses. To get the address we can use the function name only without using the parenthesis.Please check the following program to get the clear idea.Example#include void my_function() { printf("Hello World"); } int main() { printf("The address of the my_function is: %p", my_function); printf("The address of the main is: %p", main); }OutputThe address of the my_function is: 0000000000401530 The address of the main is: 000000000040154BRead More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
198 Views
We know that we need to declare variables before using it in our code. However, we variables can be assigned with 0 or 1 without declaration. In the following example we can see this.Example#include #include x, y, array[3]; // implicit initialization of some variables int main(i) { //The argument i will hold 1 int index; printf("x = %d, y = %d", x, y); for(index = 0; index < 3; index++) printf("Array[%d] = %d", i, array[i]); printf("The value of i : %d", i); }Outputx = 0, y = 0 ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
920 Views
We have used the integer and character variables many times in our program. Here we will see how they are stored in the memory.In C the character values are also stored as integers. In the following code, we shall put 270 into a character type data. So the binary equivalent of 270 is 100001110, but takes only first 8-bits from right. So the result will be (00001110), that is 14. Then stores the value into variable a. It also gives warning for overflow.In the next variable y, we are trying to store negative number say -130. The negative number will ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
4K+ Views
Here we will see what is the pre-increment and post-increment in C or C++. The pre-increment and post-increment both are increment operators. But they have little differences.The pre-increment operator increments the value of a variable at first, then sends the assign it to some other variable, but in the case of postincrement, it at first assign to a variable, then increase the value.Example#include using namespace std; main() { int x, y, z; x = 10; y = 10; z = ++x; //z will hold 11 cout
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
375 Views
Here we will see how to generate the preprocessed or preprocessor code from the source code of a C or C++ program.To see the preprocessed code using g++ compiler, we have to use the ‘-E’ option with the g++.Preprocessor includes all of the # directives in the code, and also expands the MACRO function.Syntaxg++ -E program.cppExample#define PI 3.1415 int main() { float a = PI, r = 5; float c = a * r * r; return 0; }Output$ g++ -E test_prog.cpp int main() { float a = 3.1415, r = 5; float c = a * r * r; return 0; }
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
4K+ Views
Here we will see how the C programs are executed in a system. This is basically the compilation process of a C program.The following diagram will show how a C Source Code can be executed.In the above diagram there are different steps −C Code − This is the code that you have written. This code is sent to the Preprocessors section.Preprocessing − In this section the preprocessor files are attached with our code. We have use different header files like stdio.h, math.h etc. These files are attached with the C Source code and the final C Source generates. (‘#include’, ‘#define’ ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
218 Views
One of the most frequent question is what will be the value of some uninitialized primitive data values in C or C++? Well the answer will be different in different systems. We can assume the compiler will assign 0 into the variables. It can be done for integer as 0, for float 0.0, but what will be for character type data?Example#include using namespace std; main() { char a; float b; int c; double d; long e; cout
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
103 Views
The wcspbrk() function is a built in function of C or C++. It searches for a set of wide characters present in a wide string in another wide string. This function is present into cwhar header file.This function takes two arguments. The first argument is destination, and the second argument is the source. As destination we have to pass null terminated wide strings to be searched. As source, we have to pass null terminated wide string, that is containing the characters that will be searched.This function returns two values. If one or more than one wide character is present, this ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
5K+ Views
In C or C++, we can use the constant variables. The constant variable values cannot be changed after its initialization. In this section we will see how to change the value of some constant variables.If we want to change the value of constant variable, it will generate compile time error. Please check the following code to get the better idea.Example#include main() { const int x = 10; //define constant int printf("x = %d", x); x = 15; //trying to update constant value printf("x = %d", x); }Output[Error] assignment of read-only variable 'x'So this is generating ... Read More