15,551 Topics
| |
// Program to show swap of two no’s without using third variable #include<stdio.h> #include<conio.h> void main() { int a, b; printf("\nEnter value for num1 & num2 : "); scanf("%d %d", &a, &b); a=a+b-(a=b); //Swaping printf("\nAfter swapping value of a : %d", a); printf("\nAfter swapping value of b : %d", b); … | |
Hi, I got some data from this table. Can it be use using (for loop) ? http://i.imgur.com/lq7WtWA.png Recently, I used (if else) function, but it seem too longer. I am new to C progrmming. Here the code (if else) funtion that I done: if (0 < result < 409 ) … | |
Hi! I have a hexadecimal word in the form of a string, and i need to convert it into binary. For eg : AA FF (there is a space in between the two parts). How do i convert this into binary ? Thanks in advance :) | |
If you carefully look at this example you will see with atoi when it runs into a string it gives the integer value of 0. So I was wondering how you tell the difference between the integer value of 0 and a string that got converted to 0. http://www.tutorialspoint.com/c_standard_library/c_function_atoi.htm | |
Is the ordering of checking if a number is between two values important? I figured this would be pretty simple to do but its not working. if(0 <= (int)strings[p][0] && (int)strings[p][0] <= 9) { printf ("NUM: %s\n",strings[p]);; } else { printf ("ID: %s\n",strings[p]); } | |
Write a function sin Left(a, b, k) that estimates the area under the sin function in the interval from a to b on the x-axis (where a≤b) by dividing the interval intoksub-intervals and adding up the areas of the rectangles in each sub-interval. The height of a rectangle in a … | |
can anyone guide me to good websites with respect to this topic "image deblur without original image" I have gone through a number of papers and codes for a week. all examples had codes which took a original good image added a blur function & then deblurred that image. I … | |
I'm having trouble with the if statement. I have verified with print statements that (int)strings_line_tokens[l][m] == 0. I thought maybe my logic was backwards since I had two not statements with an or, so I changed it to an and. That didn't help either. if((int)strings_line_tokens[l][m] != 10 || (int)strings_line_tokens[l][m] != … | |
Hello, this is a very strange problem. I had first put this discussion in the Linux and Unix thread, since I believe it is actually a problem with how the data is entered via but the vi editor, but I closed those out and will put it in the C … | |
How to Store Multiple file data in nested structures. i have for e.g File1.txt ========= ADD:1,2 MULTIPLY:3,4 PRINT:HELLO WORLD File2.txt ========= SUBTRACT:4,5 DIVIDE:5,7 PRINT:HELLO NAME I need a C Program to store The file data in structures. And According to command given should do what is required. The size of … | |
How to count number in C language ? For example , I have have input 5 until 7 then it will print 3 or input 2 until 4 then it will print 3 here my code: #include <stdio.h> int main() { int n,count=0; printf("Enter an integer: "); scanf("%d", &n); while(n!=0) … | |
Hi, how to make counting numbers ? For example, I send command to HyperTerminal, then it will reply (print) counted values. Here the first example, send command: UI1-UI10 reply command: UI1-UI10_in_Hexadecimal:0x3FF The above example, Ui1 until Ui10, it count, one until ten. Then, the binary will have IIIIIIIIII (10bit), but … | |
Is there a way to split a string at different types of characters into separate strings? char str[] ="(I) 44like22 .cookies. ,This, /is\ ?tricky?"; Something like this? ( I ) 44 like 22 . cookies . , This , / is \ ? tricky ? | |
I have seen both ways for reading file error messages. Is one better than the other? Is exit(0) better than return 1 or vice versa? FILE *fp; fp = fopen(argv[1], "r"); //Open file for read. if(!fp) { printf("Error opening file %s!",argv[1]); //Program prints error message and closes if file is … | |
I need to read a file that is completely random and do something based on whatever character I get. I can get any of these character types "/", "*", a string, or numbers. I need to do something different with each case. I think the best way would be to … | |
i need samples on calculating average the average of "C Program=50" "Html5=70" "DreamWaver=70" "SQL Server=80" | |
Hi All, I am trying to write perl code for extract 'C' user defined function from 'diff' format file. I am using the below keyword to identify the function 'starting pharse' (return value). I am not familar about 'C'. Please suggest some addtion return type which missing from the below … | |
use a do while loop to calculate the minimum of 100 integers. How to?? plesae help meee | |
I created a 2D array and filled it with random values from 0 to 100 and now i'm trying to find the average and maximum number of all the value inside it. But i'm having serious problems understanding the problem with my functions and how to connect them in the … | |
Write a C program which finds out prime numbers between the range 1 to MAX by creating n child processes and subdividing the task equally among all child processes. Value of MAX and n are passed as command line arguments. The parent process must wait until all child process finishes. | |
Hello There, Can I someone explain this problem. I dont understand what mean. I have read over and over i still dont get it. Assume you need an application that operates on two kinds of data types D1 and D2. Both D1 and D2 need to be defined with typedef. … | |
I need a Sample of of calulating the Average of "C Program=50,HTML=50 and others THREE examples" (NOTE;USING CODE BLOCKS COMPLIER WILL BE DEEPLY APPRECIATED) | |
Compute the definite integral of the curve x 2 − 3 x + 2 for x ranging from 2 to 8. Compute the same by approximating it by dividing the region into many small trapeziums. Keep increasing the number of trapeziums to get to the accuracy of 3 decimal … | |
Compute number of days between two dates of the same year. A date is given as two numbers (day, month). Assume that month of Feb has 28 days | |
#include <stdio.h> #include <stdlib.h> char* format(char* buffer,size_t size, const char* name,int quantity,int weight){ snprintf(buffer,size,"Item: %s Quantity: %d Weight: %d",name,quantity,weight); return buffer; } int main() { char *buffer = (char*)malloc(90); printf("%s\n",format(buffer,sizeof(buffer),"Axle",25,45)); return 0; } When i run the above program, i expect the output Item: Axle Quantity: 25 Weight: 45 But … | |
Hi All, in below code snippet, I have been facing memory leak issue while free memory for string.Could you let me know thereason for the same.I believe if we are allocating memory then it needs to be freedbut what i observed if i don't free the memory it works fine … | |
Hi, from the result in my "for" loop, have stored four value. How to extract that value to show the value(sprintf) ? Kindly refer to the attached the image file. Thanks Regrads, nazif | |
Can you please explain the reason of the garbage output instead of the each words in the string.. #include <stdio.h> #include <string.h> #include <stdlib.h> int count = 0; //char** memptr = NULL; char** push(char* word, char** memptr){ if(count > 1) memptr = (char**)realloc(memptr, (count * sizeof(char*)) ); memptr[count - 1] … | |
Hi, I got error in send_string(lala): how to fix it ? thnaks ... #include <p24Hxxxx.h> #include <libpic30.h> #include <stdio.h> int FBS __attribute__((space(prog), address(0xF80000))) = 0xCF ; //_FBS( // BWRP_WRPROTECT_OFF & // Boot Segment Write Protect (Boot Segment may be written) // BSS_NO_FLASH & // Boot Segment Program Flash Code Protection … | |
I need help in writing a the following programs in C language: We want to determine whether a long string of a’s and b’s has the property that the number of a’s is even and the number of b’s is even. Algorithm 1: Keep two binary flags, the a-flag and … |
The End.