15,551 Topics

Member Avatar for
Member Avatar for newbie14

Dear All, I have a function with input parameter as const u_char *p. So when I write like this printf("\n\n Char value p : %.2x",(unsigned int)p[1]). It gives me a hex value. How to print the whole p value which method is best to use. I need to analyse it …

Member Avatar for newbie14
0
459
Member Avatar for karoma

Hi guys, I'm trying to develop a card program, which seems to be working fine, with the exception of the dealing part. The deck is initialised, shuffled, then is supposed to deal out 5 cards without duplicates. However I keep seeing duplicates when I deal. I've ran though it countless …

Member Avatar for WaltP
0
128
Member Avatar for benclifford

Hi, I have a task to perform which all to do with the smurfs, reading from a file and doing some simple stuff to it. The last part I need to do is print out a list of all smurfs and their corresponding role in alphabetical order. I am hoping …

0
242
Member Avatar for megaman656

for example, i want to combine two number 6 and 8 and it will equal 68. is this possible in C? [ICODE]int a = 6, b = 8,c; c=ab; [/ICODE] and c will = 68.

Member Avatar for VernonDozier
0
103
Member Avatar for arnamoy10

Hello; For the below program, I am trying to create a procnanny program which will monitor the processes according to the specification said in a configuration file. The parent process will create fork() child processes each for monitoring a process as specified in the configuration file. The configuration file is …

Member Avatar for arnamoy10
0
172
Member Avatar for linezero

[CODE]void merge() { if(start==NULL) { start=start2; } else { temp=start; while(temp->next!=NULL) { temp=temp->next; } temp->next=start2; } temp=start; if(start==NULL) printf("\nList is empty"); else { printf("\nElements of the list:\n"); while(temp!=NULL) { printf("%d\t",temp->info); temp=temp->next; } } system("pause"); system("cls"); main(); }[/CODE] the following code is use to merge two linked list into one and …

Member Avatar for thines01
0
183
Member Avatar for myk45

Hello. i was trying to solve this problem: [B]You’re given an array containing both positive and negative integers and required to find the subarray with the largest sum (O(N)). Write a routine in C for the above. [/B] i was able to find the largest sum. However,i had little trouble …

Member Avatar for VIKAS REDDY
0
722
Member Avatar for patthar

My application is testing devices connectivity using ping (ICMP) functionality. It is working fine for all devices but for a particular device that is CISCO wireless controller it is not able to ping the device. I am able to ping the device through command prompt but when i debug my …

0
47
Member Avatar for jodzjcm

I have this code: Note: boom.ok[1][0] has the character "a" while boom.ok[[tempr[0]][0] contains the string "ay". [CODE]if ( strcmp(&boom.ok[1][0],&boom.ok[[tempr[0]][0]) == 1) printf("Hello"); if ( strcmp(&boom.ok[1][0],&boom.ok[[tempr[0]][0]) == 0) printf("Hello");[/CODE] None of these statement prints hello. Why?

Member Avatar for Ab000dy_85
0
91
Member Avatar for varul7

C program to replace all the letters of a string with all 26 alphabets and to do permutations to all the substituted ones and finally store the resulted strings in a file.. please help me out in fixing this situation.. To be clear. let me quote an example: If i …

Member Avatar for varul7
0
920
Member Avatar for mustafasadikot

i m having trouble with updating the fie. every time the code is executed, the variables are not retrieved from the file and start from the scratch. moreover, the file is not updated. plz reply

Member Avatar for WaltP
0
127
Member Avatar for Xheis

Hi, so I have this assignment to create a scheduling algorithm, I tried looking everywhere for help on how to create one and the closest one was here, where I found a great source code, yet I tried to modify it with my assignment variables and I created some nasty …

Member Avatar for histrungalot
0
3K
Member Avatar for ineedsomehelp:3

[CODE]void alternate(char wordWord[][MAX],char wordVar[],int word[],int i,int j, int k, int l) { char ang[4],si[3],ni[3],ay[3],sa[3],kay[4]; int X,Y,Z1,Z2; strcpy(ang,"ang"); strcpy(si,"si"); strcpy(ni,"ni"); strcpy(ay,"ay"); strcpy(sa,"sa"); strcpy(kay,"kay"); tokenize(wordWord,wordVar,word,i,j,k,l); if(wordWord[j][k] == ang[4] || wordWord[j][k] == si[3]) X = wordWord[j][k]; else if(wordWord[j][k] == ni[3]) Z1 = wordWord[j][k]; else if(wordWord[j][k] == ay[3]) Y= wordWord[j][k]; else if(wordWord[j][k] == sa[3] …

Member Avatar for ineedsomehelp:3
0
329
Member Avatar for sridhar.selva

[CODE]#include <stdio.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <termios.h> int main() { int fd; int wd=0; unsigned char buff[] = { 0x02, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x23, 0x01, 0x21, 0x03}; fd = open("/dev/ttyS0", O_RDONLY | O_NOCTTY | O_NDELAY ); if (fd == -1) …

Member Avatar for Ab000dy_85
0
260
Member Avatar for rushikesh jadha

why this code not produce any reaction on any command [CODE]#include<stdio.h> #include<unistd.h> #include<fcntl.h> #include<stdlib.h> void count(char c,char *fn) { int lc=0,wc=0,cc=0,handle; char ch; if(handle=open(fn,O_RDONLY)==-1) { printf("File %s fail to open",fn); return; } while(read(handle,&ch,1)!=0) { if(ch==' '||ch=='\n') { wc++; }else cc++; } if(ch=='\n') { lc++; } close(handle); switch(c) { case 'c': …

Member Avatar for thekashyap
0
154
Member Avatar for arold10

I want to write this function integerPower(base, exponent) that return the value of base^[I]exponent[/I] For instance integerPower(3, 4) = 3*3*3*3 The function has two parameters my question is how can I use the for loop to control the calculation? It's not that hard to use the for loop when the …

Member Avatar for arold10
0
314
Member Avatar for Silver-Eye

So I'm fairly sure I have everything in the correct order, it compiles correctly, but when I try to run I just crash after the first Employee ID input. I've tried all i can think and have searched the web yet can't figure out why it crashes. [CODE] #include <stdio.h> …

Member Avatar for zeroliken
0
164
Member Avatar for varunrathi

i am working on a program to find the factorial of a number of any length. i have used an integer array to store the digits of the result. the problem is that i am unable to store more than 32000 digits in the array. if i give a larger …

Member Avatar for gerard4143
0
1K
Member Avatar for hwoarang69

in test function the for loop work fine but printf(num[0])is getting 0. does any one know why? [CODE] int main(void) { char num[20]; num[0] = '3'; num[1] = 'a'; void test(num); } void test(char num[]) { for(a = 0; a < 20; a++) { printf("%c",num); } printf("%c",num[0]); } [/CODE]

Member Avatar for rubberman
0
81
Member Avatar for hwoarang69

does any one know why my for loop work fine but printf("%c",num[0]); get me 0? [CODE] void test(char[]); void test2(char[]); int main(void) { char num[10]; test(num); test2(num); } void test() { num[0] = '1'; num[1] = '2' } void test2(int num[]) { for(a = 0; a < 10; a++) { …

Member Avatar for rubberman
0
137
Member Avatar for CKShia

What is meaning of "nature of entity"? e.g. kind of function, global variable? Is there any code to check it? Also, how to detect the memory section in memory map? e.g. environment, command line arguments, code/, global initialized data, global uninitialized data, stack, heap etc. Is there any code to …

Member Avatar for Ancient Dragon
0
197
Member Avatar for sridhar.selva

serial port problem is occuring,,, pls guide on the same as i new to this,,, [CODE]#include <stdio.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <termios.h> int main() { int fd; int wd=0; unsigned char buff[] = { 0x02, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x23, 0x01, …

Member Avatar for sridhar.selva
0
408
Member Avatar for sharathg.satya

hi all can i know how to find greatest of two numbers? the condition is we should not use any comparision operators.. thanks in advance

Member Avatar for sharathg.satya
0
123
Member Avatar for kahheng93

Hi,im making a console application,i would like certain printf:("") to have different colour than the others,is that possible?

Member Avatar for kahheng93
0
66
Member Avatar for rithish

[CODE]#include <stdio.h> #include <stdlib.h> int main () { int i,n,big; int * pData; printf ("Amount of numbers to be entered: "); scanf ("%d",&i); pData = (int*) calloc (i,sizeof(int)); if (pData==NULL) exit (1); for (n=0;n<i;n++) { printf ("Enter number #%d: ",n); scanf ("%d",&pData[n]); } big=pdata[0]; for(n=0;n<i;n++) { if(big>pdata[n]) { big=pdata[n]; } …

Member Avatar for deceptikon
0
124
Member Avatar for rithish

what is the use of malloc,calloc,realloc ?? i studied i didnt get proper knowledge .why instead of this why cant we use array???

Member Avatar for deceptikon
0
121
Member Avatar for MrAppleseed

I'm currently working on a dictionary library in C and would like to start using struct's for easy assignment. Now, I have several functions that need to be a member in said struct's. I have it working well using pointers, but my only problem is that I would like to …

Member Avatar for L7Sqr
0
108
Member Avatar for irre

hi there im wondering about the difference between: int nr; if(!((nr--)%5)){...} if(!((nr--)%5)){...} and: int nr; if(!(--nr)%5)){...} if(!(--nr)%5)){...} is it right that in case 1 nr will be decremented after true/false comparison and in case 2 in advance? assuming nr=123456; in case 1 it would be true for second if.... and …

Member Avatar for WaltP
0
150
Member Avatar for rithish

[CODE]#include<stdio.h> struct rec { int i; float PI; char A; }; int main() { struct rec *ptr_one; ptr_one =(struct rec *) malloc (sizeof(struct rec)); ptr_one->i = 10; ptr_one->PI = 3.14; ptr_one->A = 'a'; printf("First value: %d\n", ptr_one->i); printf("Second value: %f\n", ptr_one->PI); printf("Third value: %c\n", ptr_one->A); free(ptr_one); return 0; } [/CODE] …

Member Avatar for deceptikon
0
112
Member Avatar for kahheng93

hi guys,i was trying to make user able to make selection again when they make an invalid input, but when i run this code,it just doesnt work that way,it goes printing the same line like crazy...did i do something wrong? [CODE] int main (void) { //Local Declarations int menu; //Statements …

Member Avatar for kahheng93
0
142

The End.