Pointer Practice Questions in C Language

Dear Sciaku Learner you are not logged in or not enrolled in this course.

Please Click on login or enroll now button.

If you have any query feel free to chat us!

Happy Coding! Happy Learning!

  1. What is the output of the following code?

Copy code

int x = 10, y = 20; int* p1 = &x; int* p2 = &y; printf("%d %d\n", *p1, *p2);

  1. What is the output of the following code?

Copy code

int x = 10; int* p1 = &x; int* p2 = p1; *p2 = 20; printf("%d\n", x);

  1. What is the output of the following code?

Copy code

int x = 10; int* p1 = &x; int* p2 = p1; p1 = NULL; printf("%d\n", *p2);

How can you pass an array of integers to a function and make the function able to modify the elements of the array?

What is the difference between a pointer and an array in C?

How can you check if a pointer is pointing to a valid memory location or not?

How can you pass a pointer to a function and make the function able to modify the pointer itself?

How can you allocate memory dynamically for an array of integers using pointers?

What is a pointer to a pointer in C and when is it useful?

How can you traverse an array using pointers?

Answers:

  1. The output is "10 20".
8. Pointers

Comments: 0

Frequently Asked Questions (FAQs)

How do I register on Sciaku.com?
How can I enroll in a course on Sciaku.com?
Are there free courses available on Sciaku.com?
How do I purchase a paid course on Sciaku.com?
What payment methods are accepted on Sciaku.com?
How will I access the course content after purchasing a course?
How long do I have access to a purchased course on Sciaku.com?
How do I contact the admin for assistance or support?
Can I get a refund for a course I've purchased?
How does the admin grant access to a course after payment?