Hi All,

Can somebody explain what is the difference between (char*) and (char**).

I am just looking for an explanation of in byte level.

Also please refer any documents related to this.

Thanks

Can you explain more about Byte level??

Just remember one thing:

char* = char[]     //1D array of chars
char** = char[][]  //2D array of chars

thanks for the reply...

i just need to know *(char**)&a ...so what is the role of char** in this .I know that char* means pointer casting of 1 byte but im always confused with char**

I'm trying to analyze what you mean!!
Let's ask C compiler to answer your question. By the way, remember allocation size is so much dependent on the machine that is running the code.

#include <stdio.h>

int main()
{
  char i[1];
  char j[1][1];

  printf("Size of char* is: %d\n", sizeof(i));
  printf("Size of char** is: %d\n", sizeof(j));
}

thanks for the reply...

i just need to know *(char**)&a ...so what is the role of char** in this .I know that char* means pointer casting of 1 byte but im always confused with char**

** means pointer to a pointer
char** a; means a is a pointer to a pointer which points to a single/sequence of characters[character array].
So if we increment a, it 'might' point to another character array

char ** can be used to represent two dimensional character arrays or array of strings...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.