- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 9
- Posts with Upvotes
- 9
- Upvoting Members
- 9
- Downvotes Received
- 7
- Posts with Downvotes
- 7
- Downvoting Members
- 6
Re:
EDIT: Please note, as I write this, the post is now 6 years old and might have some outdated information. I'd personally recommend beginners start with "Learn C the hard way" by Zed and this book since I have heard good things about them. Reading the FAQ put together by … |
|
Hi, When i debug the program using gdb , the gdb is entering the definations of std lib functions (ex: printf, strcpy ect) and other internal functions. Initially the debuger was working fine, i dont have clue when it got changed.I guess some of the flags of gdb might have … |
|
Hi , I am trying for a program which takes any no of characters as input and stores, so obviously i would need DMA. My approch is to Take a buffer of some fixed size(5 in this case) Fill the buffer till the fixedsize-1 Allocate memory dynamically and store the … |
|
hi, i have seen somany people asking about fnding loops in a single linked list. i would like to know is there any advantange or necessity for having loops in a linked lists. is there any application that really requires loops in lists. Thanks, Gaiety |
|
I have some strange problem which i started facing from yesterday. i have used GDB many times on my system , but yesterday when i started running GDB , my dubugger is enterings the library functions code part also which is very irritating for me. I mean if the program … |
|
I have executed the below program several times, most of the time i got the same out put but some times output is different. sample out put is: > skylab@skylab:~/Nx/Thrds$ gcc 3.c -lpthread > skylab@skylab:~/Nx/Thrds$ ./a.out > Scheduling policy = ??? > arg = 20 > 1arg = 20 > … |
|
Hi, Can somebody please explain , printing with structure variable also working. int main( void ) { struct bitfs { unsigned char a:4; unsigned int b:5; }; struct bitfs bf = {15,31}; struct bitfs2 { unsigned char a:4; unsigned int b:5; }bf2 = {15,31}; printf("a= %u \n", bf.a); printf("b= %u … |
|
Hi, I know i am asking a question which can be googled and find lot of explanation. I have actually gone through many but none explained the ownership property completely. > Mutex is acquired by some process, only that process can unlock it how the other process/thread know that the … |
|
Hi, I have added sleep with random timings and printed the values. I am actually expecting the "Blocked in Child" OR "Blocked in Parent" out put when other process sleeps. But it it never printing the statement.(when the process is going to sleep the semaphore is not cleared so i … |
|
Hi All, I have read that the system call "execlp" will take the first arguement as the file name(or path), second arguement as the command and all others are arguements to the command terminated by NULL. i have written below program. [CODE] #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> … |
|
Re:
[code]main() { int a=5; a=++a + ++a; printf("%d",a); }[/code] the output is 14..how come? |
|
Re:
[CODE=c]int OperateGumBallMachine(void){ int total = 0; char input = getchar(); RefillGumBallMachine(); for(input; input != 'x'; input = getchar()){ if(gMachine.iNumBlueGumBalls + gMachine.iNumGreenGumBalls + gMachine.iNumRedGumBalls == 0){ RefillGumBallMachine(); } switch(input){ case 'n': total += NICKLE; if(total >= QUARTER){ total -= QUARTER; DeliverGumBall(); printf("Your change is %d cents\n", total); total = 0; } … |
|
Hi, I want to print the word that start with h(not case sensitive). i tried with below code but its printing only one charater 'H'. i dont understand the metacharaters and regular expressions much. i understood that $1 will have the first match and $2 will have second match and … |
|
Hi, I have just started learning PERL. below is the code i have written , i am expecting the same order that of array when i print the contents. but the output was [ICODE] 29 25 Michael 29 Walter 34 Donny 25 Sobzchak 30 [/ICODE] can some body please clarify … |
|
Hi , what is the behaviour of below pseudo code. [CODE] pipe(fd) if(fork()){ read(fd[0]); } else { write(fd[1]); write(fd[1]); } [/CODE] I understand how system calls work , but could not understand the behaviour when used differently. secondly if a process uses while(1); in side its block, will the entire … |
|
I have created few files and Makefile in the same place. I have read in below link about the special variables $@ and $< and used as so. [URL="http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/"]http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/[/URL] but when the say make i keep getting the error [ICODE]gcc -o calc *.o /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../crt1.o: In function `_start': (.text+0x18): undefined reference … |
|
Re:
Hi there I have written the following code to read some data from a file and bin the data into bins of equal size so I can plot this data easily. [CODE]#include <stdio.h> #define N_HITS 1800 #define N_TIME_BINS 78 int main() { int i, time_bins[N_TIME_BINS],j; double event; double hit[N_HITS],value; FILE … |
|
[CODE] #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main( void ) { int fd,nob; char str[1024]; fd = open("test.txt",O_RDWR|O_CREAT,S_IRWXU); if (fd < 0) { perror("open:"); exit(0); } nob = write(fd,"hello first",1024); close(fd); printf(" %d nob written",nob); fd = open("test.txt",O_RDWR); nob = read(fd,str,1024); close(fd); printf(" %d nob … |
|
Re:
Returns the largest sum of contiguous integers in the array Example: if the input is (-1, 2, -3, 2, 0, 5, -11), the largest sum is 7 Time complexity is O(n). |
|
Hi, I just started unix programming . below are the two files i am using for reading/ writing from/to a named pipe called RNP. read.c is run on one terminal and write.c is run on other terminal. write.c is accepting the input , but read.c is not reading the input … |
|
Re:
[CODE] #include <stdio.h> #include <stdlib.h> int main() { FILE *fp; char ch; fp=fopen("exp.txt","w"); while( (ch=getchar()) !=EOF) { putc(ch,fp); } fclose(fp); return 0; } [/CODE] I am using gcc compiler in linux mint This code is not working only exp.txt is created which is empty. |
|
Hi, I have recently gone through some C internal stuff, addressing schemes(logical,relocatable and physical). what i dint get here is how are these inter-related.I do understand that these three are genearated by different tools. I want to know how exactly one is useful for other in executing the program in … |
|
Hello , i have read the manual page of alloca , it is documented there that "alloca works similar to the malloc but it allocates memory from stack and frees automatically. i can't get how can i use that in a program . if i'm not wrong can i use … |
|
Hi, if any one has any idea "how the switch statement works". does it maintain any tables internally or any other machanism? and is there any way to make the switch statement efficient? |
|
Re:
how can I output 123454321, if i input 5. and 1234321 if i input 4? |
|
below is the code for traversing a binary tree without using recursion but the problem with the code is we require array of pointers to store all the nodes address. in below program the parameter nodes in the function push is an array of pointers to store all the node … |
|
Re:
Hello, Can someone explain me what does this mean? "40[^\"], %*c" Thanks |
|
Re:
I am very much a beginner and trying to create a linked list, asking the "user" to input 5 or 6 values. My problem is that I don't know the correct terminology or how to store the user's input so that I can create my pointer to the next value … |
|
[CODE]/* Function to find prime number if so return 1 else return 0 */ #include<stdio.h> #include<math.h> int isprime( int num ) { int i ; int sq = ( int ) sqrt ( num ); /* here check should be done for num = 0 and 1 other wise 0 … |
|
i am clear with the concept of Array of pointers & pointer to an Array. but i wonder what is the advantage of creating a pointer to an array though the same can be done just by using twod array with row and col indexes. please some let provide me … |