15,552 Topics
| |
| Hello! I am trying to make a mimic code of LS command in C. It is compiled with gcc in ubuntu, and I have some questions to ask. I have used opendir to open current directory, and then i read each directory using while loop to print all the directories … |
I am newbie in controllers' programming. Recently, reading manual about ADSP controllers, I saw the key word ".section" in the c code. In another books I saw just "section" without dot. What do these directives mean? And is there any difference between these cases? My compiler works fine with "section," … | |
Has the following code any practical utility apart from showing the working of pointers? I got it while learning c in which the tutorial showings the features of pointer. Does a C programmer use this kind of code where a int pointer has been declared first and assigned a value … | |
All right. So I'm taking an assembly language class, but we apparently also need to use a smattering of Unix and C. Our assignment is to create a function that converts from the input base to a listed base. Example of a call: ConvertToBase(057,10) should return 47 (the input was … | |
Lets say I have a shared library in Linux, written in C, with a single function that simply returns the pointer to a string literal. [code]void *ReturnObject() { return (void *)"\xFA\x03\x44\x10\xE0"; }[/code] When this library is loaded by the host application at runtime and this function is called, is the … | |
What is EOF. How is it generated? Which key corresponds to "end of file" on the keybord?? | |
Can anyone please debug the following binary tree program, it flashes two errors: 1: Type mismatch in redeclaration of 'strdup' 2: Tpe mismatch in redeclaration of 'talloc' [CODE]#include<stdio.h> #include<ctype.h> #include<string.h> #define MAXWORD 100 struct tnode *addtree(struct tnode *, char *); void treeprint(struct tnode *); struct tnode { char *word; int … | |
Here is a program to create two threads in which parent thread read the count of character in inputting string and child thread reverse the string up to that count ! [CODE] #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <pthread.h> struct pass { int c; char *arr; }; … | |
Hello, I am working with genetic programming for classification techniques in data mining. I am not very much clear about how to perform genetic programming in C. Can i please get some sample code of genetic programming... An example program for any application would be fine. I just need some … | |
| |
I got the problem with this code.. can anyone explain me the output.. main() { int i = 258; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );} | |
Hii I have developed a code in which i have two check those 2 digit numbers whose 3 times sum is equal to the number eg:-27=3(2+7) [CODE] #include<conio.h> #include<stdio.h> int main() { clrscr(); int a,b,n; long sum=0; loop:for(n=24;n<=28;n++) { a=n/10; b=n%10; sum=sum+(a+b); } if(n==(3*sum)) { printf("%d \n",n); } else { … | |
Hi people im new here. I want to work with security but i got many issues with this simple program. I want to encrypt and decrypt a msg with openssl cmds. Btw im using pipeline and process open (popen) function. Im using Fedora gcc to compile. Any help, recommendations will … | |
So from what I've been taught, in school and in books, all C programs(I assume C++ too) always have main(). That's very explicitly mentioned. However in my poking around with some relatively large open source projects in hopes of learning something, it isn't as straight forward. What I've encountered was … | |
I know C++, but I'm trying to learn C. Anyways, what am I doing wrong here. If I delete the line with 'scanf', it will compile so obviously I'm doing something wrong there. Anyways... [CODE]#include <stdio.h> int main() { int x; printf("enter a number\n"); scanf("%d", &x); printf("Your number is: %d\n", … | |
need a[CODE][/CODE] in C that converts any given BCD to GRAY Code, and any given GRAY to BCD. I am a started so little halp ;) | |
Hi, I got a doubt about for loop while i was thinking about time complexity.... Is increment operation in for loop a two steps operation i.e., increment i and assign it the i or an one step operation just like just incrementing it? Is there any pointer operation involved in … | |
Hello. I have a file merg.txt: [COLOR="Red"]1 3 11 14 1 5 8 13 1 1 9 10 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 12 13 3 3 3 3 3 3 3 3 3 3[/COLOR] | |
I need to get the current time from Internet using C language. Any help is appreciated, hopefully a source code sample. Thank you in advance. | |
Title says it all: I am wondering in what kind of situations a programmer would use a union vs using a structure. I'm pretty new to this stuff and my book only devotes about 2 pages to Unions so it isn't the best source of info on Unions really, but … | |
I've been trying to code a link list in c and though it seems fairly straight forward I'm getting strange output. My link list nodes: [CODE] struct OBJECT { int Status; struct OBJECT *P_LINK; struct OBJECT *N_LINK; struct VALUE *P_VALUE; }; [/CODE] Link list [CODE] struct llist { struct OBJECT … | |
well...i tried in google...but actually i didn't quite get it. :) [url]http://www.thinkage.ca/english/gcos/expl/c/lib/fflush.html[/url] in the above link they are saying, user should definitely NOT write code of the form [CODE]printf("Prompt: "); fflush(stdout); gets(s);[/CODE] but before we used fflush after printf...for example [URL="http://www.daniweb.com/forums/post1168561.html#post1168561"]here[/URL] jephthah gave a solution where he used fflush after … | |
I wanted to know the advantage of consts over macros. And I found the line "The main disadvantage of macro is it doesn't do type checking.". Is it not an advantage of macro? So that I can #define any constants without a limit. Can you pls explain me why it … | |
hi, i wrote the following piece code to create a new bitmap file with random RGB values. I wanted to copy the header from the input file. the problem is it adds two additional bytes to 3rd and 4th (just after the magic number). i can't figure out why. // … | |
I am trying to port some software from an embedded product into the windows environment using VS2010. Its C code and it has 2 threads that send messages to each other. Whats the best method for communication? I am having a hard time finding the right way to do a … | |
Hi i got some problems with c pointers...feelin trouble to get through it..here is a problem .anyone plz explain the solutin to me.. #include<stdio.h> main() { int arr[3]={2,3,4}; char *p=arr; p=(char*)((int*)(p)); printf("%d",*p); p=(int*)(p+1); printf("%d",*p); } | |
Hi, I am trying to create a UDP broadcast server so that I can send out data to every computer on our local network for aircraft testing. I can get every component of the system to work except for the broadcast part... As I understand it, if I want to … | |
[CODE]#include<stdio.h> #include<conio.h> void main() { int x=01234; printf("%d",x); }[/CODE] the above c code will produce output 668(value of x) why? | |
Here is the codes for Binary Search and Linear Search. [B]Binary Search[/B] [CODE] #include<stdio.h> int main(){ int a[10],i,n,m,c=0,l,u,mid,j,x; //variable assigning printf("Enter the size of an array->"); //Entering the size of the array scanf("%d",&n); printf("\nEnter the elements of the array->");//Entering the array elements for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(i=0;i<n;i++) { //loop to sort … |
The End.