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*/
}
Answer / susie
Answer :
*k = &a
Explanation:
The argument of the function is a pointer to a pointer.
Is This Answer Correct ? | 1 Yes | 0 No |
Write out a function that prints out all the permutations of a string. For example, abc would give you abc, acb, bac, bca, cab, cba. You can assume that all the characters will be unique.
5 Answers IITR, Microsoft, Nike,
main() { int i; i = abc(); printf("%d",i); } abc() { _AX = 1000; }
main() { struct date; struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }
main() { show(); } void show() { printf("I'm the greatest"); }
Finding a number which was log of base 2
Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };
void pascal f(int i,int j,int k) { printf(ā%d %d %dā,i, j, k); } void cdecl f(int i,int j,int k) { printf(ā%d %d %dā,i, j, k); } main() { int i=10; f(i++,i++,i++); printf(" %d\n",i); i=10; f(i++,i++,i++); printf(" %d",i); }
main() { char *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }
What is the output for the following program main() { int arr2D[3][3]; printf("%d\n", ((arr2D==* arr2D)&&(* arr2D == arr2D[0])) ); }
A program that will create a movie seat reservation. The program will display the summary seats and its status. The user will be ask what seat no. to be reserved, then it will go back again to the summary to display the updated seat status. If the seat no. is already reserved then it will prompt an error message. And also if the input seat no is out of range then it will also prompt an error message. The program is continuously running. Termination of the program will depends on how the programmer will apply. Sample output: Movie Seats Reservation Summary of Seats: Seat 1: Available Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 1 Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 6 The Seat no. is out of range! Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 1 The Seat no. is already reserved! Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 0 GoodBye... Thank You!!!
Write a program to implement the motion of a bouncing ball using a downward gravitational force and a ground-plane friction force. Initially the ball is to be projected in to space with a given velocity vector
main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }