15,551 Topics
| |
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 … | |
| 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 … |
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 … | |
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. | |
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 … | |
[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 … | |
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 … | |
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 … | |
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? | |
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 … | |
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 | |
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 … | |
[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] … | |
[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) … | |
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': … | |
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 … | |
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> … | |
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 … | |
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] | |
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++) { … | |
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 … | |
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, … | |
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 | |
Hi,im making a console application,i would like certain printf:("") to have different colour than the others,is that possible? | |
[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]; } … | |
what is the use of malloc,calloc,realloc ?? i studied i didnt get proper knowledge .why instead of this why cant we use array??? | |
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 … | |
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 … | |
[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] … | |
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 … |
The End.