c language input and output pointers define a type

An array of integers

//
 
#include " the stdafx.h " 
#include " stdlib.h " 

int the _tmain ( int argc, _TCHAR * the argv []) 
{ 
int * Q = ( int *) the malloc ( the sizeof ( int ) * . 5 );    // the malloc dynamic allocation function of the address space of five integers. 

the printf ( " Please INPUT: " ); 

for ( int I = 0 ; I < . 5 ; I ++ ) 

Scanf ( " % D " , Q + I);   for

(int i=0;i<5;i++) 
 
printf("%d ",*(q+i));
    system("pause");
    return 0;
}

2 is defined with input and output a string

#include " the stdafx.h " 
#include " stdlib.h " 

int the _tmain ( int argc, _TCHAR * the argv []) 
{ 
char * STR = ( char *) the malloc ( 100 );    // the malloc function dynamically assigned address space. 

the printf ( " Please INPUT: " ); 

Scanf ( " % S " , STR);    


the printf ( " % S " , STR); // do not add Note * 
    System ( " PAUSE " ); 
     return  0  ;
}

 

Guess you like

Origin www.cnblogs.com/mhq-martin/p/11392106.html