>char *input;
>fgets(input, strlen(input), stdin);
// input is a char pointer,and u should allocate memory for it first
char input[1024];
fgets(input,sizeof(input),stdin);
Type: Posts; User: winbill
>char *input;
>fgets(input, strlen(input), stdin);
// input is a char pointer,and u should allocate memory for it first
char input[1024];
fgets(input,sizeof(input),stdin);
make sure you have linked mysql's lib
your makefile should like:
LIBS = -L/usr/local/mysql/lib -lmysqlclient
$(CC) -o $(EXECUTABLE) $(OBJS) $(LIBS)
void _ftime( struct _timeb *timeptr );
Header
<sys/types.h> and <sys/timeb.h>
Compatibility
Win 95, Win NT
Parameter
timeptr
The GetDiskFreeSpaceEx function obtains information about the amount of space available on a disk volume: the total amount of space, the total amount of free space, and the total amount of free space...
>for(i =1; i<= 8; i++)
>{
>printf("%d", (result & 0x0080) !=0);
in tc 2.0 sizeof(int) is 2, in gcc it is 4,so replace it with:
for(i =1; i<= sizeof(result)*8; i++)
{
printf("%d", (result &...
time_t isn't a structure, it is "long integer",it declared in time.h
and time() returns the time since the Epoch (00:00:00 UTC, January 1, 1970), measured in seconds.
>printf("The Element is %d and its index is %d\n", array[i],++i);
i=-1
1. ++i, i==0 now.
2. printf("The Element is %d and its index is %d\n",array[0],0);
........
a better way to do this :
void do_who_wins(void)
{
int Array[]={-2,1,2,-1,0};
int computer_choice,i;
char *Message[]={"You win!\n","You loose!\n","You tie.\n","Bug: win table\n"};
char...
#include<stdio.h>
int main(void)
{
char Cmd[20],Param[30],Temp[10];
bzero(Cmd,sizeof(Cmd));
bzero(Param,sizeof(Param));
printf("Input command and...
>char input[5] = "hello";
char input[6]="hello"; // input[5]=='\0'
or char input[]="hello"; // sizeof(input)==6
u should ask "compiler" first.
The rand function returns a pseudorandom integer in the range 0 to RAND_MAX. Use the srand function to seed the pseudorandom-number generator before calling rand.
BTW: in vc's...
>for(x=0;x<strlen(str)-i; x++){
for(x=0;x<=strlen(str)-i;x++){
//str[strlen(str)]=='\0'
execlp("clear",0);
or execlp("tput clear",0);
http://www.ioccc.org/winners.html#alphabet
#include <stdio.h>
#include<string.h>
int main(void)
{
char scale[12];
float temp;
float temp2;
printf("Would you like to convert Fahrentheit or Celsius?\n");
void *memcpy( void *dest, const void *src, size_t count );
dest : New buffer
src : Buffer to copy from
count : Number of characters to copy
~~~~~~~~~~~~~~~~~~~~~~~~
The memcpy function...
strcmp(scale,"Fahrenheit");
or case insensitive
_srticmp(scale,"Fahrenheit");
declared the structure out of main, or u can't "see" it in details1.
do not press the function key.
The getch function reads a single character from the console without echoing. getche reads a single character from the console and echoes the character read. Neither...
in function messageEncoding
>*pMessage++;
>*pMessage2++;
->
pMessage++;
pMessage2++;
add *pMessage2=0;
before display the encrypted message
in function main()
>char *p = &message;
should be char *p=message;
> getMessage(*p);
> isValid(*p);
> encrypt(*p);
->
getMessage(p);
estimating the area of graph by many small rectangles will be a better way.
function atoi() [atol() or strtol() ] convert a string to int [long].
and _itoa() or sprintf(StringBuffer,"%d",Integer) covert int to a string.
hmm, but it make the same mistake.
if the linked list has only one item.
Like
[1]->NULL
>if((*tos)->next != NULL) *tos = (*tos)->next;
>I don't go there if it is NULL.
so after...