1,494 Posted Topics
Re: [QUOTE] Pointer topic and the use of it totally useless. [/QUOTE] If this were true then every program would cease to run...Maybe I misunderstood your posting... | |
Re: [QUOTE=sree_ec;1091228]Thank you.. could you please explain the reason also in detail...[/QUOTE] If you want to see the reasoning, try verifying the addresses that your passing. start with the original address, then verify it in the first function and then verify that its the same in the second function. | |
Re: [QUOTE=Iam3R;1089673] the things i dont undestand here is : 1) why the command nm Lib_Symb.o and Main_Symb.o are not having any address refereence, all address are zero there. 2) is there any relation between addresses in the command nm a.out because there are different things that are specifeid at some … | |
Re: [QUOTE=john butler;1091791]Basically what is the system level difference between language C and C++ ?[/QUOTE] Could you give us an example of what you mean by system level. | |
Re: [QUOTE=Crushyerbones;998096]Hello guys, I'm trying to make this work [CODE]all: daemon client daemon: cd ./daemon; make daemon client: echo going in cd ./client; make client clean: cd ./daemon ; make clean cd ./client ; make clean[/CODE] But I'm having 2 problems: 1) Make ALWAYS tells me there's nothing to be done. … | |
Re: Only quickly checked but do initial this value...stsize. My mistake...There it is stsize=sizeof(struct emp); | |
One day while pondering about C I came up with this program. Can you predict what the answer will be? Now run it, were you right? filename.c [CODE] #include <stdio.h> #include <stdlib.h> int main(int argc, char**argv) { unsigned long *iptr = (unsigned long*)0;/*pointer equals 0*/ unsigned long ans = (unsigned … | |
![]() | Re: Here's a little blurb from Linux's 'man make' [QUOTE] 6.9 Variables from the Environment ================================== Variables in `make' can come from the environment in which `make' is run. Every environment variable that `make' sees when it starts up is transformed into a `make' variable with the same name and value. … |
Re: [QUOTE=msr;1065524]Hello, Im using threads in a recent project. I would like to know whats the difference between: pthread_kill() and pthread_cancel() What are the effects of each one? Thank you![/QUOTE] If your using Linux/Unix try open a terminal and type man pthread_kill man pthread_cancel and it will retrieve all the info … | |
Re: I hope this link will straighten you out: [url]http://en.wikipedia.org/wiki/End-of-file[/url] | |
Re: I modified your code somewhat so you can see what's going on... 1. Run the code below, what values did you get for A, B, C, D, E ? 2. Now un comment the fgetc(stdin) lines and run the code again what are the values now This should tell you … | |
Re: Try googling freopen()...plus here's a small example of redirecting stderr to a file named output. [CODE] #include <stdio.h> #include <stdlib.h> int main(int argc, char**argv) { freopen("output", "w", stderr); fputs("send this to stderr\n", stderr); exit(EXIT_SUCCESS); } [/CODE] | |
Re: Check out this link: [url]http://www.onlineconversion.com/roman_numerals_advanced.htm[/url] | |
Re: [QUOTE=anatz;1088825]hi,.im a first year student taking information technology, never mind where i am studying.,,,i just want to ask some tips to understand easily turbo c.,.[/QUOTE] 'Easily understand C' is probably a misnomer but if you have any questions about one of the best programming languages 'C' then fire away... | |
Re: [QUOTE] how can i read each number and define it as an integer ???? [/QUOTE] Try googling strtol, strtoll, strtoq - convert a string to a long integer | |
Re: [QUOTE] Rules: • Please solve it on your own/submit your own solution. [/QUOTE] What don't you understand about the above rule? | |
Re: [QUOTE=marirs07;1088520]is it possible in c program to run two processes at the same time.For example i want to run a timer along with my application .The timer must be shown on the screen.Thanks in advance[/QUOTE] The short answers is yes with clarification as to what you mean by "same time". … | |
Re: [QUOTE=jp071;1087438]I am still in problem. i could not solve the segmentation fault. could anybody know me in more details?[/QUOTE] Could you post your updated code..So we can see what you changed. | |
Re: [QUOTE=matthewl;1087396]Lets say I have two functions that I want to run simultaneously for different purposes as example a function handles an XML RPC requests and the other function handles an IRC connection to an IRCD. what my goal would be to avoid program hang ups on user requests. Is pthreads … | |
Re: [QUOTE=nigelmercier;1087328]Hi guys, I'm pretty much a C newbie, but I've dabbled in other languages over the years. For my current project I'm using mikroElektronica Pro C on a PIC microcontroller. I've got a 2-dimensional array defined like this: [CODE]const char FONTTABLE[96][5]= { {0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x5f,0x00,0x00}, {0x00,0x07,0x00,0x07,0x00}, /** [90 rows snipped] **/ … | |
Re: I read this posting a few times and I'm at a loss..Do you mean if you have a number say: unsigned int myint = 87456; do you want to extract from it 8 - 7 - 4 - 5 - 6? | |
Re: [QUOTE=shadwickman;1086857] So would some compilers know that only freeing the list should free all its indices, or would I always get a memory leak with that? Either way, I want to know if there's an ANSI standard on this... which is probably the second method here if anything. Thanks in … | |
Re: check out this link: [url]http://en.wikipedia.org/wiki/Sizeof[/url] | |
Re: Number one its assignment to a structure and you have some major problems with your code...I'm looking at it right now. | |
Re: Look at how I displayed the binary number...its much easier to read, besides that the code code looks O.K. [CODE] #include <stdio.h> #include <stdlib.h> #include <math.h> int reversebits( unsigned int n ); /* prototype */ int reversebits(unsigned int n) { unsigned int temp = n; int i; for(i = (sizeof(n) … | |
Re: Added a few things [CODE] #include <stdio.h> #include <stdlib.h> int arrayToplam (int *a, int size ); int main() { int i, j = 0; int *x = (int*)NULL; printf(" Kac Sayi Toplamak Istiyorsunuz: "); scanf("%d",&i); x = malloc(sizeof(int)*i); if (!x) { fputs("could not allocate memory!\n", stderr); exit(EXIT_FAILURE); } for (j … | |
Re: Right away you shouldn't use: [CODE] char name[20]; scanf("%s",&name); [/CODE] It should be: [CODE] char name[20]; scanf("%s",name); [/CODE] Wasn't this just posted? Also main should return a value. | |
Re: [QUOTE=johndoe444;1082122]hi, [CODE]#include <stdio.h> int* get_int() { int arr[100]; arr[0] = 5; printf("arr %p\n",arr); return arr; } int main() { int* p = get_int(); printf("got %p\n",p); return 0; }[/CODE] for the code above I get this warning message: [CODE]test-heap.c: In function ‘int* get_int()’: test-heap.c:5: warning: address of local variable ‘arr’ returned … | |
Re: Number one, your trim function doesn't return anything...so if I had to guess str is getting whatever is in the eax/rax register.. [CODE] str = trim(str); [/CODE] | |
Re: [QUOTE](If this even works, which I'll test in a second[/QUOTE] You posted this without even showing the ambition to try it first? | |
Re: [QUOTE=johndoe444;1082056]Hi, I want to write a log function but I want to implement in the style of fprintf/sprintf style. ie [CODE] fprintf(arg1, template string, template values) write_to_log(template string, some array of ints/double etc to fill the template) [/CODE] I want to implement this variadic function: [CODE] void write_to_log(char template, int … | |
Re: Try googling setvbuf(). This function allows for unbuffered writes.. | |
Re: [QUOTE=johndoe444;1081281]Hi, In java, we can run a program remotely by doing something like this: [CODE]Runtime.exec("ssh machinename programname")[/CODE] I was wondering whether I can do the same in C using some standard library function call. Also is this possible to get a handle to the remote program's input/output to see its … | |
Re: try running this code...you'll be able to see your output which I cropped at 100 [CODE] #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int a, c; a=3; c=2; for (c=2; c<100; c++) { for (a=3; a != a%c; a++) { printf ("%d \n", a); if (a > … | |
Re: [QUOTE=redroze;1076726]hello folks, I have an array of integers and I need to search if there's a combination of 2 numbers that resault a defined sum. No loops or static variable are allowed. Any suggestions? cheers, Elad.[/QUOTE] You could try recursion. | |
Re: I'm not sure what program was run to get that output but info binutils will list all the binary utilities that are available in Linux. Maybe if you gave us a little more to go on....What are we looking at? | |
Re: This should really be posted in the assembly section. | |
Re: Just curious, If you run this program what's your outcome [CODE] #include <stdlib.h> #include <stdio.h> #define ARR_SIZE 10 int main() { int i = 0; unsigned long *myint = NULL; myint = (unsigned long*)malloc(ARR_SIZE * sizeof(unsigned long)); for (i = 0; i < ARR_SIZE; ++i) { fprintf(stdout, "addr->%p\n", (void*)myint++); } … | |
Re: This may not be 100% but I always though of global and external variables as indicators to the linker such that: global variable is available out side of the file its defined in. external variable is defined out side of the file its used in. | |
Re: Memory is aligned on word size. This is done for efficiency reasons, You really should continue exploring memory and how its laid out, its an interesting subject - may I suggest you look into packed structures.. | |
Re: Number one, I have to ask, how strict is your definition of palindrome? Would you consider this one - Madam, I'm Adam Where punctuation, case and spaces are ignored. | |
Re: Please read this: [url]http://www.daniweb.com/forums/announcement118-2.html[/url] If your looking for the answer without any effort try googling | |
Re: I would use two for loops - one counts down from the number of asterisk and then another that counts up to the number of asterisk. | |
Re: Quick question, how are you passing your char pointers? From what I can see your passing the pointer value and not the characters that make up the character array. The pointer values from the client application have no valid meaning in your server application. | |
Re: [QUOTE=rehaam;1077113]Hi I need help;; Write a program to simulate a demand paging system. The program should implement the FIFO and LRU page replacement algorithms presented in Chapter 10 of the textbook. Your program input should include: The name of the page replacement algorithm. Information about the number of physical page … | |
![]() | Re: Here's an example of passing/allocating a pointer in a function [CODE] #include <stdio.h> #include <stdlib.h> void Test(char **cptr); int main() { char *str; Test(&str); fputs(str, stdout); free(str); return(0); } void Test(char **cptr) { int val = 0; printf("How many characters do you want to enter->"); scanf("%d", &val); getc(stdin); *cptr = … ![]() |
Re: I tried this in Mandriva and it worked [CODE] #include <stdio.h> int main() { char str1[100]; char str2[100]; printf("Enter 1st string\n"); scanf("%[^\n]s",&str1); fgetc(stdin); printf("Enter 2nd string\n"); scanf("%[^\n]s",&str2); printf("1st string is %s\n", str1); printf("2nd string is %s\n", str2); return 0; } [/CODE] | |
Re: [QUOTE=fenerista;1075308]I want to make a module that print console, current folder name like pwd, but I don't know how with system calls ? or something else ? if system calls, what is the system call of that ? and how can I use this system call on my module.?[/QUOTE] I'm … | |
Re: The first example your trying to change a const string - char *ptr = "String"; with the line *str ='T';(Note I assumed str is a typo and should be ptr) which is not allowed and for the "Hello, World" try: printf("%s%s","Hello", "World"); |
The End.