• Register
632 points
●7 ●1

If a novice C learner programmer is asked what is the most difficult thing in C language, the answer will be straightforward. "Pointer" There are pointers in other languages ​​too but they are rarely used.  The programmer has a harder time understanding the terminology than the actual concept of pointers

For example, when the programmer of C says that there is such and such a variable pointer, what does that mean?  Able is pointing in a direction or pointing to something. To avoid any difficulty, we will try to understand the pointers under the terms you are already familiar with.

Example:-


#include <string.h>
#include <iostream>
using namespace std;
int main(){
   char *str="Kodlogs";
   cout<<"original string::"<<str;
   cout<<endl<<"String after reverse::";
   for(int i=(strlen(str)-1);i>=0;i--){
      cout<<str[i];
   }
   return 0;
}

Output:-

Original string::Kodlogs
String after reverse::sgoldoK

 Int i = 3; this declaration will issue an order to the compiler of c. 1. Allocate space to store an integer value in memory.  Attach the name of the variable i to this memory address. 3. Save the amount of 3 in this memory address. Every place in memory has a number called location number or memory address. Let's see an example and help pointer.  Create a program to reverse the string from.

1 Comment

Useful trick and helps for beginners.Thank you so much