Pointer questions in c pdf




















We can apply them alternatively any no. In the above code, ptr is a pointer to first character of string g. Question 9. Question 9 Explanation:.

In C, array parameters are always treated as pointers. So following two statements have the same meaning. People use it only for readability so that the reader is clear about the intended parameter type. The bottom line is, sizeof should never be used for array parameters, a separate parameter for array size or length should be passed to fun.

The reason for using pointers in a Cprogram is. Pointers allow different functions to share and modify their local variables. To pass large structures so that complete copy of the structure can be avoided.

Question 10 Explanation:. See below explanation A With pointers, address of variables can be passed different functions can use this address to access the variables.

B When large structure variables passed or returned, they are copied as everything is passed and returned by value in C. This can be costly with structure containing large data.

To avoid this copying of large variables, we generally use poitner for large structures so that only address is copied. Java uses reference variables to implement these data structures. Note that C doesn't support reference variables. You have completed. You have not finished your quiz. If you leave this page, your progress will be lost.

We use cookies to ensure you have the best browsing experience on our website. Start Your Coding Journey Now! C interview questions with explanation. Good c interview questions and answers. Pointers interview questions. Storage class interview questions. Email This BlogThis! Newer Post Older Post Home. User Settings. Skip carousel. Carousel Previous. Carousel Next.

What is Scribd? Explore Ebooks. Bestsellers Editors' Picks All Ebooks. Explore Audiobooks. Bestsellers Editors' Picks All audiobooks. Explore Magazines. Editors' Picks All magazines. Explore Podcasts All podcasts. Difficulty Beginner Intermediate Advanced. Explore Documents. Infrequently Answered Questions in C. Uploaded by Rashmi Nambiar.

Did you find this document useful? Is this content inappropriate? Report this Document. Flag for inappropriate content. Related titles. Carousel Previous Carousel Next. It is a 32bit pointer, which has as much of its value in the segment register as possible.

Since a segment can start every 16bytes so the offset will have a value from 0 to F. Given a pointer D: , we convert it to a 20bitabsolute address D7, Which then normalized to D See this article for more detail , click here. No, you have to manually deallocate the allocated memory. The allocated memory is managed my memory management function and memory allocates from the heap memory. Both expressions are different. Explanation: In the above example, two operators are involved and both have the same precedence with a right to left associativity.

In another word, we can say it is pre-increment of value and output is , , Explanation: In the above example, two operators are involved and both have the same precedence with the right to left associativity.

In another word you can say it is pre-increment of address and output is , , An array of pointers to string is useful when sorting the strings, we need to swap only pointers instead of swapping the whole string which helps in the efficient use of memory and time. A memory leak is a common and dangerous problem. It is a type of resource leak. In C language, a memory leak occurs when you allocate a block of memory using the memory management function and forget to release it.

Note: once you allocate a memory than allocated memory does not allocate to another program or process until it gets free. If the size of the requested space is zero, the behavior will be implementation-defined.

The return value of the malloc could be a null pointer or it shows the behavior of that size is some nonzero value. It is suggested by the standard to not use the pointer to access an object that is returned by the malloc while the size is zero. There is a lot of application of double-pointer in C language but here I am describing one important application of double-pointer. If you want to create a function to allocate the memory and you want to get back the allocated memory from the function parameter, then you need to use the double-pointer in that scenario.

See the below code,. You can see this article, click here. Yes, we can use const and pointer together. I have created a list of some interview questions related to the const and pointer. See the list, click here. See this article, Click here. Note: If you want an explanation of the below programs, then write a comment in the comment box I want to listen to your thoughts. If you love online courses and want to learn C programming, you can check the below courses it will help.

See this Article, Addition of pointer in C. If you want to add another C pointer interview questions in this list, then your welcome.

I will publish the mentioned pointer interview questions in C with your name. If you have any other suggestions for this C pointers questions list, then please write in the comment box either you can directly email to admin aticleworld.



dmarserdoho1988's Ownd

0コメント

  • 1000 / 1000