What is the output of following code:
#include <stdio.h>
main()
{
char *p = 0;
*p = 'a';
printf("value in pointer p is %c\n", *p);
}
Answers
Answered by
0
Code :
Input :
#include <stdio.h>
main()
{
char *p = 0;
*p = 'a';
printf("value in pointer p is %c\n", *p);
}
Output :
$ cc pgm.c
$ a.out
Segmentation fault (core dumped)
About Run Time Error :
❋ This program has run time error.
❋ The error seen oftenly while a program is executed.
❋ A pop - up menu will come that will show that the program has run time error
❋ This error will be resolved after 10 - 15 seconds.
Answered by
0
Answer:
think many of the compilers will give an error or may your program will be crash bcz first of all you must initilize a pointer variable ,which points a valid memory location.
******here,char *p=0(i.e,p is a null pointer)null pointer means a pointer variable doesn’t contain of any valid memory location of memory block
Similar questions