what is difference between declaring the pointer as int and
char in c language?
Answers were Sorted based on User's Feedback
Answer / karan
means of integer pointer a pointer variable which contains
a address of an integer value...means the address in the
pionter variable points to a integer type value....
And the means of chracter pointer, pionter variable is
contain a integer address of a character type value..
Is This Answer Correct ? | 11 Yes | 2 No |
Answer / abhay3023
The first obvious difference is char pointer will store address of character variable and same way integer pointer will store address of integer variable.
But the main difference you will feel when do increment on both these pointers, integer pointer will get incremented by 4 bytes and character pointer will get incremented by 1 bytes.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / k vishwanath pillay
While declaring Pointer for an Integer value, we assign a
default size i.e 4 byte of memory for the Integer variable.
But in the case of char by default it assigns 1 byte of
memory for that character variable.
The type of declaration is the same for both.
Char a[5], *p; // for char variable
int *i; // for Int variable
Is This Answer Correct ? | 5 Yes | 10 No |
What is the output of the below program and how it is? void main() { static int var=5; printf("%d",var--); if(var) main(); }
8 Answers MindFire, TCS, Tech Mahindra,
Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.
Can I pass constant values to functions which accept structure arguments?
How can I prevent another program from modifying part of a file that I am modifying?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
which one is better structure or union?(other than the space occupied )
write a program to delete an item from a particular location of an linear array?
if the address of a[1,1] and a[2,1] are 1000 and 1010 respectively and each occupies 2 bytes then the array has been stored in what order?
4 Answers Amazon, Apple, Bata, Google, NASA,
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
Difference between null pointer and dangling pointer?
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
What is const and volatile in c?