15,540 Topics

Member Avatar for
Member Avatar for prashanth s j

Hi all, the following code prints garbage values. I want to read from an array two bytes and print then as a short int after doing ntohs. What is the bug in the code? Thanks and Regards, Prashanth [code] #include<stdio.h> struct converter { unsigned short int i; }; main() { …

Member Avatar for prashanth s j
0
191
Member Avatar for sanagopi

[code] main() { int i=0xff; printf("\n%d",i<<2); } [/code] please tell me how to work out this code... and what will be the output...

Member Avatar for Banfa
0
2K
Member Avatar for melusim

I am tring to pass an array to a function but when i compile it says array undeclared first use in function.i thought once i pass it as parameter it becomes known by the function.here is my code: /* Write a program that reads quizzes from a file 'q.txt', randomly …

Member Avatar for terminato
-1
235
Member Avatar for gerard4143

I have a question about functions and pointers to functions.... Why does a C program treat a function call to a function and a function call to a function pointer the same? [CODE] #include <stdio.h> #include <stdlib.h> typedef void (*funcptr)(void); void myfunc(void) { fputs("Hello, World!\n", stdout); } int main(int argc, …

Member Avatar for gerard4143
0
168
Member Avatar for MrNoob

hi, I have some problems with winsock library so I am calling loading it dynmically then calling the functions so far so good,but the problem is for example I see in the winsock2 header files that - GetHostByName and some other functions are which I use there prototypes is kinda …

Member Avatar for UncleLeroy
0
95
Member Avatar for manutd4life

Hello, i need to do a program which takes an input sequence of characters from the alphabet {A,B,C} and compresses it by replacing each subsequence of a particular character by a single occurrence of the character, and the length of the substring. e.g. Input : AAAAABBBBBBBCCBBBAABBCCCCCS Output: A5B7C2B3A2B2C5 i dont …

Member Avatar for manutd4life
0
161
Member Avatar for sanagopi

i need a detail explanation about left shift and right shift operators in c..its very hard to understand it..especially when i am using shifting on hex and oct values...seems to quite confusing me...i got the output..but i dunno how it comes...please clear my doubts.. thank you

Member Avatar for sanagopi
0
129
Member Avatar for niyujin

My English is very poor...there must be a lot of mistake in my expressions. but It would be very kind if you can answer my question... 3Q. In c compiler ( vs 2010 express c++), I tried the code as follow, 0 error 0 waring. In C++, it is the …

Member Avatar for gusano79
0
197
Member Avatar for yuvaraj.ragupat

Hi, I want to read ctrl-c ctrl-z values from serial port. is there any ways to read? Regards Yuvaraj

Member Avatar for yuvaraj.ragupat
0
74
Member Avatar for tomtetlaw

whenever i run this code: [code=c] void _freecommands(void) { command_t *com; for(com = cmd.commands; com->name; com = com->next) free (com); } [/code] i get one, even though i've malloc'd them previously and the conditional statement checks if they're not valid i don't understand why, can someone help me?

Member Avatar for Radical Edward
0
56
Member Avatar for idlackage

I'm reading in a text file that contains a little custom script. However, one line of that script gets ignored and I can't figure out why. Script: [CODE]# Test Case #1 - Simple Movement RESET FORWARD 2 PAUSE 1 REVERSE 2 PAUSE 2 TURNRIGHT 2 PAUSE 1 TURNLEFT 2 PAUSE …

Member Avatar for Radical Edward
0
96
Member Avatar for rai32

Hello guys, i am making a simple test using select() for a future program i must do. What i'm trying to do is very simple, i have a client, and a server. The client listens to both stdin and sockfd using select. The objective is as follows: If i write …

Member Avatar for rai32
0
307
Member Avatar for tomtetlaw

when i run this code, f is being set to null and i have no idea why.. i know for a fact that cmd.argv(1) at that point is "vars.rc" because i debugged it with breakpoints. [code=c] FILE *f; if(cmd.argc() != 2) { con.printf("writevars: <filename>\n"); return; } f = fopen(cmd.argv(1), "w"); …

Member Avatar for tomtetlaw
0
2K
Member Avatar for tam13

Hi, So I'm new to C and I'm trying to get the max temp from my user input and the print out in a table the temperature's from 0 to max temp in celsius and fahrenheit. However I can't seem to get the maxtemp from my getinput function. I was …

Member Avatar for aspire1
0
104
Member Avatar for sanagopi

[code]main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); }[/code] i have doubt in this program where we are using 2 scanf statment which is nested one...y we are using +scanf..is this corect?? if so please expalin it..

Member Avatar for Adak
0
87
Member Avatar for Him3

Hi, Everybody, I wrote the program to connect to the Microsoft Sql server 2000. I have also defined constrains and triggers on Tables of SQL. Now I want to catch the error message generated by the triggers or constraints in c prog and want to show it to user. Can …

Member Avatar for monu chauhan
0
472
Member Avatar for Neen14

how I can simplify fraction after do some process on it (add, sub...) this part of program (add fraction) [CODE]int i,j,k,m,a,b,c,d; char x; printf("Please Enter fraction number 1\n"); scanf( "%d%c%d",&a,&x,&b); printf("please Enter fraction number 2\n"); scanf("%d%c%d",&c,&x,&d); if (b == 0 || d == 0){ printf("undife number\n"); system ("pause"); } else …

Member Avatar for wildgoose
0
123
Member Avatar for iwanttolearnc

[CODE]return((int)ADHR << 2);[/CODE] im trying to learn what a certain function does and then i stumble upon this part. i do get that << 2 means shift left by 2. what i do not know is the (int)ADHR part. can anyone help me out with this? thank you

Member Avatar for iwanttolearnc
0
100
Member Avatar for Alerwiali

i have a 2D matrix of characters or integer or whatever!How do i check if another matrix is a sub-matrix of The 2D one ...Please!! help with simple code that work for any size of the matrices Thanks in advance to all

Member Avatar for Alerwiali
0
64
Member Avatar for Ferny84

I'm supposed to ask the user to enter a number of marks, and to decide what each mark is. Then my program is supposed to find the min and max in the array, so far this is what my code looks like: [CODE]#include <stdio.h> void findMinAndMax(int arrayMarks[], int numOfMarks) { …

Member Avatar for Ferny84
0
130
Member Avatar for newcoder777

Hi everyone, can somebody guide me to produce very small delays for controlling a servo motor using PWM. I need to generate 3 different pulse widths of 1.2ms , 1.5ms and 1.8ms. I am using Keil compiler, and 8051 microcontroller. I am a good C coder, but dont understand much …

Member Avatar for newcoder777
0
274
Member Avatar for nada massoud
Member Avatar for abhimanipal
0
31
Member Avatar for yasemin

Hi, Im having trouble dealing with text files in C. I want to be able to move through the text file which Ive used fseek(). But how do I read one character or read a line of characters from the position I want and change these to float? Thanks in …

Member Avatar for abhimanipal
0
127
Member Avatar for sdinu96

I want database management in C To ADD,LIST,DELETE,INSERT using structures and files..........not in linked list.............. can anyone help me out....because this is the first time to do long and some what complex program for me

Member Avatar for abhimanipal
0
4K
Member Avatar for device

I want to take out words that reoccur in array1 and put them in array3. (so in array 3 there would be only distinct values) the problem is.. i dont understand how the count2 value can reach so high. (over 300) but should be 20 maximum. [code=c] for(i=0; i<count;i++){ if(count2==0){ …

Member Avatar for WaltP
0
89
Member Avatar for iwanttolearnc

im trying to use c to interface with a zilog microcontroller. the problem is that i cant do much without the library <ez8.h>. ive been searching the web now for any links to download this particular library to no avail. does anyone know where i can get this library? thanks …

Member Avatar for iwanttolearnc
0
153
Member Avatar for learnerAccess

[code = c] #include <stdio.h> #include <string.h> int main() { int n = 0x000000FF, i; char *p = (char *)&n; for(i = 0; i < sizeof(int); i++) printf ("value : %d\n", *(int *)(p + i)); return 0; } [/code] I'm expecting something like 255 0 0 0 OR 0 0 …

Member Avatar for learnerAccess
0
87
Member Avatar for littlestewie

[CODE]#include <stdlib.h> #include<iostream> #include<conio.h> typedef struct kume1{ int data; struct kume1 *next; }; typedef kume1 *kume1ptr; void insert(kume1ptr *x,int a); void del(kume1ptr *x); int main(){ int t=1; kume1ptr first1=NULL; kume1ptr first2=NULL; int x; int i; for( i=10;i>=1;i--)//ikisi içinde 20 şer tane random sayı üretiyoruz { x=rand() % 100 + 1; …

Member Avatar for abhimanipal
0
99
Member Avatar for toddermohan

[CODE]#include<stdio.h> main() { FILE *fp; fp=fopen(*PR1.c","r"); if(fp==NULL) { puts("cannot open"); exit() } }[/CODE] -------------- in this program why they are using *fp and pl reason full program.. and also how fp=fopen(*PR1.c","r"); works

Member Avatar for Radical Edward
0
113
Member Avatar for toddermohan

[CODE]FILE *fp fp=fopen ( const char * filename, const char * mode ); //// or //// FILE * fopen ( const char * filename, const char * mode );[/CODE] if i am asked to say "how u say?" in c language like direct command line code or what.. they say...

Member Avatar for tesuji
0
116

The End.