#include<stdio.h>
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s;
printf("%d",s->x);
printf("%s",s->name);
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
Compiler Error
Explanation:
You should not initialize variables in declaration
| Is This Answer Correct ? | 10 Yes | 3 No |
Answer / anand
Compilation error
you should not iniialize the structure variable inside the
declaration.
| Is This Answer Correct ? | 4 Yes | 2 No |
There is no syntax error.
Pointer s is declared but never initialized.
Using uninitialized pointer , trying to access members(x and name) of structure results in invalid access of memory.
Hence segmentation fault.
| Is This Answer Correct ? | 0 Yes | 0 No |
main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }
Write a program to check whether the number is prime and also check if it there i n fibonacci series, then return true otherwise return false
#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }
write a c program to Reverse a given string using string function and also without string function
How to reverse a String without using C functions ?
33 Answers Matrix, TCS, Wipro,
What is the hidden bug with the following statement? assert(val++ != 0);
program to find the roots of a quadratic equation
14 Answers College School Exams Tests, Engineering, HP, IIIT, Infosys, Rajiv Gandhi University of Knowledge Technologies RGUKT, SSC,
Find the largest number in a binary tree
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
In the following pgm add a stmt in the function fun such that the address of 'a' gets stored in 'j'. main(){ int * j; void fun(int **); fun(&j); } void fun(int **k) { int a =0; /* add a stmt here*/ }
write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?
How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.