19,876 Topics

Member Avatar for
Member Avatar for ghalib951

`Inline Code Example Here What is the output of the following code: int x; int*p; int*q; p = new int [10] ; q = p; *p = 4; for (int j = 0; j<10; j++) { x = *p; p++; *p = x + j; } for (int k = …

Member Avatar for NathanOliver
-1
132
Member Avatar for kayleigh0411

I am trying to implement a test program to describe what this function does: int mystery( const char *s1, const char *s2 ) { for( ; *s1 != '\0' && *s2 != '\0'; s1++, s2++ ) { if( *s1 != *s2 ) { return 0; }//end if }//end for return …

Member Avatar for rubberman
0
303
Member Avatar for Habib_7

for example i have a void pointer : void *pt; int k=80; pt=&k; now i want to incement it by one byte ,is it just enough to use (++(char*) pt) or I should use (void*)(++(char*)pt) by this asssumption that i wnat to cast it again to int ,char ,... later.

Member Avatar for Habib_7
0
120
Member Avatar for Vahid_1

Hello, I'm just started to study malloc and realloc, so i just wrote this program to copy two string from user input and consenterate them. then ofcource print it. #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char *str = malloc(3) gets(str); int sl = strlen(str); str = realloc(str, …

Member Avatar for sepp2k
0
219
Member Avatar for Habib_7
Member Avatar for negru

Hi. I need help with this program: Example input: 2 4 6 -1 7 3 -2 1 Output: 3 3 (longest series of even is 3, longest series of positive is 3) Here is the code: #include <stdio.h> int even(int x) { return x % 2 == 0; } int …

0
95
Member Avatar for jai_5

I am printing in my c program which deals with structures but not able to understand why getting a small box containing 0001 in box.printing is fine but the uneccessay boxes are coming. I dont know what they actually mean.

Member Avatar for jai_5
0
341
Member Avatar for ryan.legow

So I am trying to make my own version of chmod using C, the modifications are to make lowercase add permissions while uppercase remove permissions (instead of using + or - to add and remove). Also, I am trying to print a help message and exit if the command cannot …

Member Avatar for ryan.legow
0
271
Member Avatar for manofprogram

I have a simple c program outputing a message asking for user input. Then a scanf function reading in user input. When the program is run, the program execute the scanf function first before printf is executed asking for user input. What is wrong with the program? int main () …

Member Avatar for deceptikon
0
129
Member Avatar for negru

I need to create dynamic string by given format(%d,%s,%f,%lf,%c) using variable number of arguments in function. This code gives me an error(main.exe has stopped working): #include<stdio.h> #include<stdarg.h> #include<string.h> #include<stdlib.h> char *form(char *format,...); char *form(char *format,...) { char *res=(char *)calloc(1,1),val_int[12],*pos_int,*val_str,*pos_str,*val_float,*pos_float,*val_lf,*pos_lf,*val_char,*pos_char; va_list args; va_start(args,format); do { pos_int=strstr(format,"%d");pos_str=strstr(format,"%s");pos_float=strstr(format,"%f");pos_lf=strstr(format,"%lf");pos_char=strstr(format,"%c"); if(pos_int && (!pos_str || pos_int …

0
153
Member Avatar for St John

a c++ program the insert new element at the end of a linked list, and allow a user to search for specific item in the linked list. pseudoode for insrtion of new elements at the end of the list

Member Avatar for Zawar_1
0
161
Member Avatar for Larry_6

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main() { char buf[15]; char *buf1 = "CE_and_IST"; char buf2 = 'z'; int fd = open("myfile", O_RDWR); lseek(fd, 10, SEEK_SET); int n = read(fd, buf, 10); printf("%d\n", n); n = write(fd, (const void *)buf1, 10); printf("%s\n", buf); …

Member Avatar for davidnelson4911
0
334
Member Avatar for CodeWarrior14

I need to allocate memory to a pointer variable passed by parameter. #include <stdio.h> #include <stdlib.h> typedef int* PTR_VALUE; int initialize(PTR_VALUE value_array) { value_array = (PTR_VALUE)malloc(sizeof(PTR_VALUE) * 94); return 0; } int main() { PTR_VALUE pValue; initialize(*pValue); printf("%d", pValue); gets(""); return 0; } but I get an error when I …

Member Avatar for CodeWarrior14
0
225
Member Avatar for P

> I am supposed to create a chain of N processes, where N is the command line parameter. Each process creates a child process, prints out its own PID and its parent's PID, and then waits for its child to terminate by calling the wait() function. #include <stdio.h> #include <stdlib.h> …

Member Avatar for P
0
175
Member Avatar for Ajay_12
Member Avatar for dennis r

I want to develop a windows forms application with text boxes and labels and data grid view.Whatever data i enter in textboxes need to be saved in database and must display in data grid.The data grid should show the previous run data also.It should be done in local db of …

Member Avatar for TekknoDraykko
0
140
Member Avatar for jnneson

Hello Sir/Ma I am a self learning buddy, I recently finish a book "Programming in C" language. I will like to know how I can develop mt skill and learn more... please help

Member Avatar for jnneson
0
133
Member Avatar for anumash

I have the following code: It gives me a segfault when I modify any element in the character string. Why is that? The first two statements print fine but as soon as I modify the value of any element in the character string it gives me an error! I have …

Member Avatar for rubberman
0
283
Member Avatar for shifiya

A super-intelligent species of coconut-eating tropical bird has decided to develop a scenic ight path roughly following the perimeter of the island that they inhabit. Owing to the impressive energy con- sumption of their overdeveloped brains, these birds can only afford to y in straight lines from one coconut tree …

Member Avatar for iamthwee
-1
150
Member Avatar for Matt_15

//This is an example, coding not complete. Say main runs the function add, int add adds two random numbers and int random gets a random number from the array. By keeping 3 functions, how would I pass b and c to int add? Right now b and c are undeclared …

Member Avatar for deceptikon
0
257
Member Avatar for Shamar_1

Write a C++ program that generates a 7 character randomized password from the set integers 1 – 9 and A-Z.

Member Avatar for ddanbe
-1
235
Member Avatar for coolbeanbob

I've spent hours, an embarrasing number of HOURS on how to read a text file into a program. The requirements have shifted, but still. I hate you C. You and all your pointers. The text file is a matrix, but with the first line being the number of rows. See …

Member Avatar for deceptikon
0
172
Member Avatar for Habib_7

hi.I need 8 search engine for my school.can you give me just the name of those algorithm (except binary search and linear search).

Member Avatar for deceptikon
0
109
Member Avatar for manofprogram

I do not know how to open audio, video, or picture files and modify there contents. Are accessing and updating those types of files the same as accessing and updating notepad text files with extension .txt?

Member Avatar for ravenous
0
98
Member Avatar for ms95

i want to implement a kind of malloc and free function for a course project , now i have done something but i dont know whats the problem with access violation in this line : head->next = (struct block_meta *) allocate(sizeof(struct block_meta)); i'd be glad if someone can help me …

Member Avatar for ms95
0
346
Member Avatar for manofprogram

I want to know if my display adapter has been accessed by a keylogger or any other program capturing my screen images. Do I need to access my CPU, display driver, or computer memory to decide if the display adapter has been accessed? How can I find out what program …

0
85
Member Avatar for habib_6

Hi,I,m writing puts()function and I want to know that I which situations it returns EOF I know that when there is an error it return EOF but whad does it mean. can you give me an example?

Member Avatar for rubberman
1
115
Member Avatar for programmingman

I want to write code to see what applications access device drivers on my computer. The drivers are disk, display, audio, keyboard, etc. Can someone introduce me on how to do this?

Member Avatar for manofprogram
0
110
Member Avatar for Shamar_1

Write a C++ program that accepts four quizzes (30%), two midterms (40%) and a final (30%) and displays the overall average. The maximum score for all quizzes and exams is 100 points.

Member Avatar for rubberman
-1
248
Member Avatar for kent.johnstone_1

In the following code I'm trying to make "SRAM", "FRAM", "EEPROM", and "FLASH" constants, MEM_TYPE an 8-bit variable that can be changed by other programs. The pointer should be pointing to MEM_TYPE. I'm getting a error under uint8_t (defined as BYTE elsewhere in an included file), "*", *and enum which …

Member Avatar for Nutster
0
245
Member Avatar for Shamar_1

Write, compile, and execute a C++ program to calculate the sum of the numbers from 1 to 100. The formula for calculating this sum is sum = (n/2)(2*a + (n-1)d), where n = number of terms to be added, a = the first number, and d= the difference between each …

Member Avatar for David W
-2
173
Member Avatar for oren.turgeman.9_1

hy when i run this command to open excel and i get error (on 2007 excel it was fine) //Excel.ApplicationClass xlApp; Excel.Application xlApp; Excel.Workbook xlWorkBook; Excel.Worksheet xlWorkSheet; object misValue = System.Reflection.Missing.Value; SaveFileDialog oDialog = new SaveFileDialog(); xlApp = new Excel.ApplicationClass(); ** xlWorkBook = xlApp.Workbooks.Add(misValue);** xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); int i = …

Member Avatar for JOSheaIV
0
310
Member Avatar for smartjugal

I want to learn C# using in windows forms from the begaining..... can anyone tell me some C# windows forms text book and the author's name? or pdf books link..????

Member Avatar for TekknoDraykko
0
331
Member Avatar for Larry_6

I'm writing a c code in order to dynamically create a sturcture like this: 1st -> 5 -> 7 -> 2, then 2->5(there is an arrow beneath 2 and link it back to 5) the data is below: struct node { int value; struct node *next; } Here is what …

Member Avatar for David W
0
240
Member Avatar for Akhila_1

Hey all, I want to learn C programming . Can you please guide me? (From where the software to be downloaded, Tutorials etc.) Thanks Akhila

Member Avatar for vegaseat
0
154
Member Avatar for NoobCoder85

The tools Hal’s sells are: Hammers: $10.99 Wrenches: $10.99 Levels: $19.99 Tape Measures: $4.99 Screwdrivers: $8.99 In order to make things easier in the long run you have decided to make a c++ program that takes in all the orders for each register and tallies them at the end of …

Member Avatar for NoobCoder85
0
1K
Member Avatar for TObannion

So I was given a stack program to convert from int to char. I converted it but the output is...not expected. Wanting someone to point me in the right direction. I will post the header and driver program of the int stack and then the header and driver of the …

Member Avatar for NathanOliver
0
329
Member Avatar for samuel1991

Hi all, I have a question on how to reverse an integer array **recursively** with only 2 paramters. #include <stdio.h> void reverseAr(int ar[], int size); int main() { int size; //Array size int ar[100]; //The array itself int i; //Index to be read in the array int numbers; //User input …

Member Avatar for David W
0
264
Member Avatar for negru

Can someone explain this code step by step: #include <stdio.h> #define MAX 10 int main() { char niz[MAX][MAX], c = 0; int d = 1, x = 0, i, j; do scanf("%s", niz[x]); while (niz[x++][0] != '0'); { float* pf; int xx, *pi = (int*)&niz[0][7]; xx = ((*pi) & 0x41000000); …

Member Avatar for rubberman
0
195
Member Avatar for brandon66

Hello everyone~! I have a text file with integers on every line like: 2397 4013 9382 5995 4961 9961 1535 146 8153 3877 5872 2690 9731 8060 8452 7873 1109 4152 7256 2437 6815 2032 2473 1090 5674 6096 7868 422 My problem is: Im not sure how to store …

Member Avatar for brandon66
0
192
Member Avatar for zaxo311

I have to write program in c linux for operating systems class - communicator using fifo which has to work like that: ./Speak create name (to create user) ./Speak send from to (to send msg from user to user) ./Speak history name (to read all msgs sent to user Every …

Member Avatar for kdusyared
0
171
Member Avatar for lewashby

[Linux & gcc] I'm taking C courses and pluralsight.com and I'm both getting an error with a program I got from one of their videos as well as having some trouble understanding something in the code #include <stdio.h> #include <ctype.h> int main() { char message[] = "Hello world!"; for(char *p …

Member Avatar for TalhaMoazSarwar
0
213
Member Avatar for sdtechi

#include<stdio.h> main() { int m1, m2, m3, m4, m5, per; printf("Enter marks in five subjects"); scanf("%d %d %d %d %d", &m1, &m2, &m3, &m4, &m5); per=(m1+m2+m3+m4+m5)/500*100; if(per>=60) printf("First division"); else{ if(per>=50) printf("Second division"); else{ if(per>=40) printf("Third division"); else printf("Fail"); } Enter marks in five subjects 100, 100, 10, 50, 60 …

Member Avatar for TalhaMoazSarwar
1
234
Member Avatar for nacedo

Lets say I want to write a very simple C program wich a is string passed with a pipe at my program and translate every letter to ASCII and store it in an array. I want to use less library as possible and not use malloc For example in a …

Member Avatar for TalhaMoazSarwar
0
205
Member Avatar for greg.lafrance.96

I am following Kernighan and Ritchie to learn C and my solution to exercise 1.19, to reverse a string, does not work. Intermediate print out indicates it is working, but the string is not reversed. Please help, and thanks. #include <stdio.h> #define MAXLINE 1000 // max allowed line length int …

Member Avatar for TalhaMoazSarwar
0
437
Member Avatar for Ctwo

Hello. Just dusting off my function knowladge in relation to pointers for refactoring in a larger project. Came up on this discrepancy. See my verbose debug output. Problem around for loop in function. Short post because adblock wiped my post form two times. :) #include <stdio.h> int mult(int x, int …

Member Avatar for TalhaMoazSarwar
0
200
Member Avatar for ryan.legow

I am trying to make a deck of cards and minipulate them in 3 files part 1, part 2, and header. In the header I am trying to make the deck so that it would be easy to call up in both part 1 and part 2. In part 1 …

Member Avatar for ryan.legow
0
2K
Member Avatar for pdk123

I have a approximate following class class ClassA : public ClassB { void HandleMessages(const u8 *pP, const u16 nMsgBodyLen); static std::map<std::pair<u32, u32>, CreateSessInfo> m_mSessionId2CCRNum2DefaultBearerId; }; When trying to access the map from the HandleMessage, I am getting the linker error, saying the undefined reference to m_mSessionId2CCRNum2DefaultBearerId; Could some c++ experts …

Member Avatar for NathanOliver
0
316
Member Avatar for lewashby

[Linux] I have had a hard time understanding pointers beyond a simple array step through and modifying one address at a time. When I get into pointers to C-structures, C++-objects and classes my head starts to hurt. And that's just to name a few. I find the C syntax `*++p` …

Member Avatar for mike_2000_17
0
434
Member Avatar for csakthikumar

Hi Guys, I have wrote a small logic below which will calculate a value called MASK via which I can calculate the starting and ending number This logic works fine if A = 0x14000000 B = 0x14000064 void main() { unsigned long ulStartVal = 0x14000000; unsigned long ulEndVal = 0x14000064; …

Member Avatar for Nutster
0
145

The End.