BIGINNER QUESTION

code 1
1
2
3
4
bool checkSmartTalk(char *cnum) {
  if (strncmp(cnum, "63919541", 8) == 0) return true;
  return false;
}


code 2
1
2
3
int checkHandler(wmsg* msg) {
    return 1;
}


code 3
 
char *autotmp;




what is the purpose of * there in 3 programs.
Last edited on
what do u mean by asterisk?
make it clear
wat is the use of asterisk?
the word asterisk?
Last edited on
I got it;)

it means,
1
2
3
4
5
6
7
8
9
10
char *cnum 
wmsg* msg
char *autotmp;

those are pointers

take a look at this link

http://www.cplusplus.com/doc/tutorial/pointers.html


Last edited on
can u give me simple code of this. thanks
Declaring variables of pointer types

The declaration of pointers follows this format:

type * name;

where type is the data type of the value that the pointer is intended to point to. This type is not the type of the pointer itself! but the type of the data the pointer points to. For example:

1
2
3
int * number;
char * character;
float * greatnumber;


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// my first pointer
#include <iostream>
using namespace std;

int main ()
{
  int firstvalue, secondvalue;
  int * mypointer;

  mypointer = &firstvalue;
  *mypointer = 10;
  mypointer = &secondvalue;
  *mypointer = 20;
  cout << "firstvalue is " << firstvalue << endl;
  cout << "secondvalue is " << secondvalue << endl;                             
  return 0;
}



Topic archived. No new replies allowed.