Hi: all:The code is like :char *data;data = malloc(1000);if (data = NULL){printf (" can not assign the memory for the packet\n");exit(1);}memset(data,'\0',1000);The code is failure say "Segmentation fault"The problem is memset, why?Thanks...
Hi I am a little bit new to C's advanced topics:I have Turbo C and I wrote a simple program to write data to file:#include<stdio.h>#include<dir.h>#include<conio.h>#include<stdlib.h>// program to write a long string to a filevoid main(){ FILE *pt;char *b;chdir("d:\\te...
"Jordan Abel" <jmabel@purdue.eduwrote in messagenews:slrndnlop7.qg3.jmabel@random.yi.org2005-11-16, Lew Pitcher <lpitcher@sympatico.cawrote:>Sandeep wrote: Clark S. Cox III wrote: 2005-11-15 12:10:43 -0500, "Sandeep" <sandeepsinghal@gmail.comsaid:Being more generic, you can lookup th...
Hi, I am a lazy cheat that does not want to know how to write C programs.I need the members of this newsgroup to complete all my homework assignmentsfor me.My teacher really does not care where I get the answers or even if Iunderstand them.So, please can you experts just do the work for me and n...
Is there anyway to literally evaluate the contents of a string in an ifstatement?For example:int i = 0;char * str = "i == 0";if(str) /* I know this doesn't do what I want */{}would be the same as:int i = 0;if(i == 0){}The general application is that I'm in interested in reading ifcondi...
Hello, I'm trying to help someone on a linux-oriented forum. I've takenhis original code and cleaned it up, but I am still wondering aboutsomething. Here's the code:#include <stdio.h>intmain(void){int a[][3]={ {1,2,3},{4,5,6,},{7,8,9} };int *b = (int *)a;int **c = (int **)a;...
[Warning] IS C does not allow extra ';' outside of a functionint n;;int main(void){}Anyone care to enlighten me as to why IS C does not allow this, butapparently ANSI c99 does?Ta...
[Warning] IS C does not allow extra ';' outside of a functionint n;;int main(void){}Anyone care to enlighten me as to why IS C does not allow this, butapparently ANSI c99 does?Ta...
For some strange reason, I thought the following would give me a valueof 168, not 166. My reasoning was that 678 - 255 - 255 = 168.#include <stdio.h>int main(void) {unsigned long a = 678;unsigned long ff = 255;unsigned long c = a & ff;printf("The value is: %u \n", c);return 0;}The value is...
Hi,How can I get a digit from integer for example, 12311, one by one forcomparision?Thanks!...
Hi,How can I convert integer, for example 12113, to char array but withoutspecify an array size in C programming?Thanks!...
Hi I am a little bit new to C's advanced topics:I need help in file handling.I have Turbo C and I wrote a simple program to write data to file:#include<stdio.h>#include<dir.h>#include<conio.h>#include<stdlib.h>// program to write your name to a filevoid main(){ FILE...

