15,551 Topics
| |
#include<stdio.h> int sum(int,int); int main() { int a=5; int b=6; int res; res=sum(a,b); printf("\n%d\n%d\n",a,b); printf("%d",res); } int sum(int x,int y) { x=x+1; y=y+3; return y; } This is a sample program where my a and b values didint change and the result of modified y (ie)9 is returned back to … | |
EDIT: Please note, as I write this, the post is now 6 years old and might have some outdated information. I'd personally recommend beginners start with "Learn C the hard way" by Zed and this book since I have heard good things about them. Reading the FAQ put together by … | |
int main() { unsigned int i=65000; while ( i++ != 0 ); printf("%d",i); return 0; } The output for this program is 1 can anyone explain me how I got this output? Thanks in advance. | |
The bubble sort is slow and I thought it would be interesting to visualize the progress as it sorts an array of integers. | |
int main() { int a=10; printf("%d",a); return 0; or return a; } # 1ts question:In the program Why you used 0 in return 0 ; and 2nd question : if you use a in return a; then it also print the correct output but why ? # | |
Hello everyone! this is a code to reverse strings of a array of char ptr. I am passing the char* array, dynamically allocating memory to reverse and link with the char* array. The print it gives in the str_rev() are perfect. But when I print same thing in main(), it … | |
Hello Everyone, I got this question in some book. As per question we need to find a substring in a array of char* and replace it with another string. The program I wrote doesn't work. I tried using strcpy as well char by char. Please help me to figure out … | |
main() { int i=5; printf("%d%d%d%d%d",i++,i--,++i,--i,i); } Answer: 45545 Thanks in advance. | |
I want to ask how to pass the '30','31','32' to SQL WHERE IN clause For example EXEC SQL DECLARE abcd CURSOR FOR SELECT Consignment FROM Transaction WHERE order_type IN (:dest) where dest will hold the value '30','31','32'. I have tried as above example but it is not working SQL did … | |
I was asked to write a program to eliminate the reoccurrence of numbers in an interview? For example if I give the input as 2233555697 then the output should be 235697 | |
| I am trying to do simple math in c using a microcontroller. The C toolset uVision that I have does not have printf scan etc functions. In any case the code below reads in two parameters p1, p2 from the user over a serial port usig a simple routine GetHexByte … |
Hey Guys! I Have A Device With a Small LCD Module Like This (http://tiny.cc/gva5pw). And I Have to Write a Code in C To Display Text on The Module ! I Also Have To Run Program in a Minimal Modified Version of FreeBSD ! So Far I Havent Started to … | |
I have made this code. It is working good. Can anyone please help me to make it more optimised? Here is the code. /* ∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑ Author: Mayukh Sarkar Email: mayukh2012@hotmail.com Country: India License: GPL public Copyright ® © ¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬ */ #include <stdio.h> #include <stdlib.h> static int size = 0; typedef … | |
The problem is while i execute my code the function modifiko_note(); doesn't work in a proper way. It execute with errors.`` #include<stdio.h> #include<stdlib.h> #include<string.h> #include<sys/stat.h> #include<conio.h> struct student{ char emri[20]; char mbiemri[20]; int nota[100]; int grupi; }stud; struct lendet{ char emri[20]; int kredite; }lenda; FILE *bin; FILE *file; void regjistro_lende(); … | |
this line returns `lvalue required as increment operand` error message with gcc-4.7 hwrcolor c; u8 *dest; *(((unsigned char *)dest)++) = c; I changed it hwrcolor c; u8 *dest; *((unsigned char *)dest) = c; dest += sizeof(c); and u32 * u32Dest; hwrcolor c; u8 *dest; u32Dest = ((u32 *)dest); *u32Dest = … | |
I have written a Makefile which compiles my mini-os with another application. I have to use -nostdioc and -nostdlib to compile them, but the problem is, that application is using stdio/stdlib functions and when I run my Makefile I get the error message that the functions used by my application … | |
Hello, I am caputing sound from a codec using a microcontroller and sending it over to the laptop using a serial port .Now I want to use this buffer of values to regenerate the captured sound in Windows using C/C++. I have no idea about how to do it?Can some … | |
Hi everyone, I’m beginner and I need a little help. I have to make RPN (postfix) calculator using stack which is implemented by singly linked list in C. Now I found that but in C++ and I’m having trouble translating it to C. Can you help me getting things to … | |
Swap 2 number without using third variable code do not use temp variable for swapping if the code was useful please let me know [code]#include <stdio.h> void main() { int a,b; printf("enter number1: ie a"); scanf("%d",a); printf("enter number2:ie b "); scanf("%d",b); printf(value of a and b before swapping is a=%d,b=%d"a,b); … | |
#include <stdio.h> int main(){ int i,j,k=1; int loop_count = 10; for(i=1;i<loop_count;i++){ if( i > 1){ for(j=0;j<i+k;j++){ if( i == 2 ) printf("*"); else{ if( j%k == 0) printf("*"); else printf(" "); } } k++; }else printf("*"); printf("\n"); } return 0; } | |
Hey, I need to create a war card game. I have a problem with linked list - I read about it but still I have a problem with writing the code. I made a deck of shuffled card and now I need to sort it out between 2 players... so … | |
Doing simple domain name search Just enter sometimes Segmentation fault I really do not know how to solve this problem But some can be found ip i not idea Read what information can solve this problem I'm sorry my English is very poor | |
Representing the list may or may not matter for a specific algorithm, but what does a list has to do with a stack/queue? | |
I am getting this error. LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library serialtest.obj : error LNK2001: unresolved external symbol "void __cdecl fastICA(double * *,int,int,int,double * *,double * *,double * *,double * *)" (?fastICA@@YAXPAPANHHH0000@Z) Debug/vctest.exe : fatal error LNK1120: 1 unresolved externals Error executing … | |
I get this error in a c code of mine error C2440: '=' : cannot convert from 'LPVOID' to 'unsigned char * if((buffer = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, totalBufferSize )) == NULL) { fprintf(stderr, "Memory allocation error\n"); ExitProcess(1); } and even this error C2440: '=' : cannot convert from 'unsigned char … | |
Hey guys, I am debugging some random files trying to get into gdb and I came accross a question how many machine instructions are used for this : `double x, dx, ans;` I guess I could see based on memory addresses and the size of double that 3 variables are … | |
hello there let me explain my work i have a file i read from it the data after that i try to get the best vertex that it's max(degree/weight) when i find it i put it's neighbors into the glist and i put it into blist and delete both of … | |
Hi all, i have been working on the Dijkstra's code for a couple of weeks and i am now puzzled on how to do it this is my code for it so far void d_run(Table T, Graph G){ Vertex V, W; V = 0; W = 0; for (int i … | |
I found the following logic for binary search from the standard book i feel it fails in some /* binsearch: find x in v[0] <= v[1] <= ... <= v[n-1] */ int binsearch(int x, int v[], int n) { int low, high, mid; low = 0; high = n - … |
The End.