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 |
#include<stdio.h> #include<conio.h> void main() {clrscr(); char another='y'; int num; for(;another=='y';) { printf("Enter a number"); scanf("%d",&num); printf("squre of %d is %d",num,num*num); printf("\nwant to enter another number y/n"); scanf("%c",&another); } getch(); } the above code runs only one time.on entering 'y' the screen disappeares.what can i do?
What is a const pointer?
Is it possible to use curly brackets ({}) to enclose single line code in c program?
How can I increase the allowable number of simultaneously open files?
Do you know the difference between malloc() and calloc() function?
Difference between goto, long jmp() and setjmp()?
Write a C program linear.c that creates a sequence of processes with a given length. By sequence it is meant that each created process has exactly one child. Let's look at some example outputs for the program. Here the entire process sequence consists of process 18181: Sara@dell:~/OSSS$ ./linear 1 Creating process sequence of length 1. 18181 begins the sequence. An example for a sequence of length three: Sara@dell:~/OSSS$ ./linear 3 Creating process sequence of length 3. 18233 begins the sequence. 18234 is child of 18233 18235 is child of 18234 ........ this is coad .... BUt i could not compleate it .....:( #include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> int main(int argc, char *argv[]) { int N; pid_t pid; int cont; if (argc != 2) { printf("Wrong number of command-line parameters!\n"); return 1; } N = atoi(argv[1]); printf("Creating process sequence of length %d.\n",N); printf("%d begins the sequence.\n",getpid()); /* What I have to do next ?????? */ }
What are dangling pointers? How are dangling pointers different from memory leaks?
What are predefined functions in c?
1.Why do you call C is middle level language? 2.Why do you call C is userfriendly language.
What is const keyword in c?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......