15,551 Topics
![]() | |
**WHY StrCpy - dosen't work normally :( ? Where is mistakes?** #include"string.c" int main() { printf("Hello World!\n"); char *text = "GOOOD TEXT ALL TIME VERY POOR "; int temp = strlen(text); char *copy_text; printf("size text: %d\n", temp); StrCpy( copy_text, text ); printf("TEXT: %s\n COPY_TEXT %s", text, copy_text ); return 0; … | |
This is what I have to code. Input an array of numbers(any numbers that user inputs from standard input, aka keyboard), remove numbers from array that are not 0 and 1. Thay array should now be bitwise moved with << or >> (again user choses the number of spaces moved … | |
I have been trying to fix this since two eeks and I have no clue what I am doing wrong. I have gotten the program to work so that it can tell if a number is prime or not, but the problem I am having is showing at the end … | |
![]() | #include<stdio.h> int main() { int pcheck=1,i; int k=1000 for(i=2;i<k;i++) { if((k%i)== 0) { pcheck=0; break; } } if(pcheck) { printf("%d is a prime .\n",k); } else { printf("%d is not a prime.\n",k); } return 0; } this code works to check any number i that write in k but when … |
Hello everybody, I was asked by an interviewer the following question. but I was not able to answer. Please get back to me if you know the answer. thank you in advance. Que: What is the exact difference between the "for" loop and "while" loop in C language ? | |
Hello everyone, Can someone please tell me to how to connect MS-Access database using C. Are there any drivers or libraries that I would have to download? Please specify in detail. Regards, Rubeea | |
Would you please help me in writing a c code to read data from a file and perform 1)numeric sort, 2)alphabetical sort. the file may contain data of any kind.Like it may contain only numbers,only names or a database of employees of a company.(which contains their employee id,name,designation and salary,....in … | |
I'm having a problem with my linked list. I want to add to the beginning of the list and delete from the beginning of the list. I get an AccessViolation which is coming from where I print out the list. I also don't think it's adding elements to the linked … | |
Here is my code that is doing the printing that gets messed up. The output is fine when you display it to your screen (terminal). Unfortunately when you redirect it to a text file it gets messed up. It displays the null characters (^@) and Enquiry characters (^E). I have … | |
I write the program in maximized screen. But my output screen is so big that I cannot see the output. The lines in which output is shown are out of the screen. When I exit TurboC, then only I can see the output as the screen is in restore down … | |
So I am working on a simple assignment for my C class that reads a formatted file and prints information about the file based on the format. The file format looks like this: #Domain Alexa Rank Site Name #------------ ----- ------- --------- amazon.com 13 1177136 Amazon.com google.com 1 4533883 Google … | |
this program is working fine.. As i was moving the object with the help of ASCII values. But i want to move the object towards right as per my input (through keyboard,right arrow). But it is moving with the same x and y axis.. | |
 i am reading "pointers in c by naveen toppo" .According to him program crashes when it encounter int y=*ptr; i dont understand why it should crash?i think its correct. *ptr gives int value. please refer attachement. | |
I've been assigned in my class to do this exact same problem: <snip> I'm wondering on how to get started. Any help would be appreciated. I know how to use the functions for c-strings, but I'm not sure if I should place all the contents of the paragraph into one … | |
![]() | Hi, I do not think this is a problem as such but an interesting behaviour to watch. I have little piece of C (to do with trying later Unicode, Polish characters and text files). I was trying to find a position of a Polish character in the alphabet string. Had … ![]() |
how to do this in C: if got: myheader.h: #define sz 5 in program if option = 2, sz for marray change to 10. extern unsigned char marray[arrsz]; also, in C file, locations[] be the first one if option = 1 or be locations[] be the second one if the … | |
Is there a good way to slow down program output? usleep and nanosleep don't slow it down enough, delay doesn't work, and sleep keeps freezing my program. I am using Linux since I think this makes a difference in what I have to use. | |
i need to Design and write a program to count the number of occurrences of each of the characters ‘A’ to ‘Z’, ‘a’ to ‘z’ and ‘0’ to ‘9 entered through stdin. i was thinking of defining a struc for char lower char upper and int digit but then how … | |
Actually, I am working on a project. I want to extract all the reviews from a website which has reviews related to movies, for example. I want to make an automated system which can extract the content of the website and save it to a file. That will be my … | |
can anyone help me in making a c program for displaying the grades(A(>60),B(45>b<60),C(30>c<45),F(fail)) of students in the form of histograms and for each grade calculation and histogram we need to use pthreads!!! so that it satisfies parallel processing!! | |
I am using fgets to read lines of a file. I am then using if statements based on the location of the new line character to decide which sscanf to use. I have been getting a lot of windows files which usually use carriage returns. Most of the timeit "seems" … | |
what is the usage of getch() function? how to creat recovery softwear? | |
Help me with ur inputs, how to insert and move the image using C language.. we can use by using "Type Argument Approach" to move the image?? | |
My IDE codeblocks 10.05 cant run a program which is overloading functions. Any help please..maybe due to settings | |
How to rectify the segmentation fault in LINUX system in C language? | |
I am trying to copy a string to an array of string. I have used these two examples before and they have worked so I don't understand why they won't work this time. I am getting a segmentation fault. http://stackoverflow.com/a/1088667/985898 http://stackoverflow.com/a/1095006/985898 I remembered to initialize everything. char *strings_mneumonic_table[503] = {0}; … | |
How would you go about converting a decimal value to hex and then do math? Every example of converting decimal to hex that I have seen creates an array and I wouldn't be able to do math if I did that. Something like this. 15 decimal to hex F 17 … | |
I have an array of characters. I am trying to find "houston". The only way I can think of to do this is to use a for loop and check each individual character. Is there an easier way to do this? char string[] = "Fishing tourism miami atlanta dallas houston"; | |
Hi, I have to create a program that creates N child processes, and they muliply the matrix. I have some base codes but when I try to run them they give me segmentation error and I cant find the problem. #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #include <sys/types.h> … | |
Hi, I am making program that finds solution how to put 12 knights(horses) to chess board that every square is dominated or engaged by other knight. Look at my code: #include <stdio.h> #include <stdlib.h> #include <stdbool.h> //(*******************************************************************************) void addNulls(char L[][9], int N[], int M[]) { int i,j,g; for (i=1 ; … | |
I am trying to clear the first character of my array. The first two methods don't seem to work. The third method seems to but doesn't look like a good idea. char operand[] = "abc"; //both methods seem to null it out operand[0] = 0; memset(operand, 0, 1); printf("%s", operand); … | |
Hi I have to write program that finds a solution how to put 12 knights to a 8x8 chess board that every square would be dominated by one of the 12 knights. Do you have any suggestions from where I can start? | |
Write a program that takes two input strings S1 and S2 and finds if S2 is a substring of S1 or not. If S2 is a substring of S1, the program should print the index at S1 at which there is a match. If S2 is not a substring of … | |
I wrote this code to find if string s2 is a substring of string s1. However I'm getting time limit exceeded. How can I make my algorithm better? #include<stdio.h> int main() { char s1[20], s2[20]; scanf("%s %s", s1,s2); char *p, *q, *count; p=s1; q=s2; int i=21; do{ if(*p==*q) /* the … | |
I'm using gcc compiler in linux ubuntu os. I's started doing windows programming in c but my compiler does not having windows.h or supporting header files. How can i include these windows programm supporting files? Can i download them externally or what else.......? | |
when converting iget erros especially in the cin parts because they are automatically passed by something #include<iostream> #include<conio.h> #include<math.h> using namespace std; int p=1; class Bank { public: char name[50],address[90],type; double ein_betrag, aus_betrag; double balance; int costumernr, accountnr, birth, tel; public: void newcostumer(); void newaccount(); void costumerdel(); void accountdel(); void … | |
How can one code a function to remove all trailing blanks from the right end of a string, assuming i use void trimRight(char a[]); | |
I am having problem getting the final result here, it keeps on looping. #include<stdio.h> #include<string.h> #include<conio.h> #include<math.h> #include<stdlib.h> #include<ctype.h> int main() { int i, t, k, max, min, sumof; printf("Enter number of integer elements in array: "); scanf("%d",&t); int a[t]; printf("Enter list of array: \n"); for ( i = 0; … | |
Write a program that reads an MxN matrix A and prints its elements in spiral order. You should start from the element in the 0th row and 0th column in the matrix and proceed in a spiral order as shown below. 1→ 2→3→ 4 ↓ 5→ 6→ 7 8 ↑ … | |
The greatest common divisor of integers x and y is the largest integer that evenly divides both x and y. Write a recursive method Gcd that returns the greatest common divisor of x and y. The Gcd of x and y is defined recursively as follows: If y is equal … | |
#include<stdlib.h> #include<stdio.h> #include<string.h> struct D { char name[20]; float balance; }d; struct C { char name[20]; int count; }c; char ch; struct A { char command[20]; char name[20]; char filename[25]; float amount; }a; struct P { char name[20]; }p; int main(char argc, char**argv) { struct A b; char str[100]; FILE … | |
Hi. I found this code online: #include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <sys/uio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> /*********************************************************************** * Global Constants * ********************************************************************/ #define A_ROW 2 #define A_COL 3 #define B_ROW 3 #define B_COL 2 #define ARGUMENT_COUNT 13 #define PIPE_QTY 4 /*********************************************************************** * Global Variables … | |
#include<stdio.h> #include <file.h> main(int argc, char *argv[]) { FILE *fp; char s[100]; int i; //char exit if((fp=fopen("Allah ya isa.mp3","rb"))==NULL) //Open file and read on binary mode { printf("Could not open the file\n"); // exit(1); } fclose(fp); } #include<stdio.h>`` main(int argc, char *argv[]) { FILE *fp; char s[100]; int i; //char … | |
guys Im a newbie here I really need your help for our project...pls help me..heres the problem..Write a C program that add a names into a file then read the names in a file and sort it alphabetically..(FILEPOINTER). | |
Hi, my requirement is that I do gets and take user name as input. Now I have to create a file name with the same name as user name. Next if I try to login as a same user from different client I need to check if that file with … | |
#include<stdio.h> #include<stdlib.h> int main() { int i,j; int ascii_value; char c; FILE *plain; plain=fopen("xx.dat","r"); while((c=getc(plain))!=EOF) { ascii_value=c; printf("%d %c\n",ascii_value,c); printf("~~~~~~~~~~~~~~~~~~~~\n"); } fclose(plain); return 0; } the file xx.dat is 12sdfsldkfj MY output is 49 1 ~~~~~~~~~~~~~~~~~~~~ 50 2 ~~~~~~~~~~~~~~~~~~~~ 115 s ~~~~~~~~~~~~~~~~~~~~ 100 d ~~~~~~~~~~~~~~~~~~~~ 102 f ~~~~~~~~~~~~~~~~~~~~ 115 s … | |
#include<stdio.h> #include<stdlib.h> int main() { int i,j; int ascii_value; char c; FILE *plain; plain=fopen("xx.dat","r"); while((c=getc(plain))!=EOF) { ascii_value=c; printf("%d %c\n",ascii_value,c); printf("~~~~~~~~~~~~~~~~~~~~\n"); } fclose(plain); return 0; } the file xx.dat is 12sdfsldkfj MY output is 49 1 ~~~~~~~~~~~~~~~~~~~~ 50 2 ~~~~~~~~~~~~~~~~~~~~ 115 s ~~~~~~~~~~~~~~~~~~~~ 100 d ~~~~~~~~~~~~~~~~~~~~ 102 f ~~~~~~~~~~~~~~~~~~~~ 115 s … | |
A company provides his staff 20% off for tour allowance of basic his basic salary and 10% off for housing rent allowance.calculate the salary in unsigned int. | |
I am working on a Texas Instrument's Board which has MSP430f47197 and the has the following code (C files). The current resolution for kWhs is .01 but I need higher than this. I changed the code to some extent but unfortunately I could not hit it to what I need! … | |
Hello! I would like to ask you for help about this: Create a program in C that inputs a random number from the keyboard( long long ), finds the sum of the numbers formed by the digits, grouped in pairs starting from the one and displays the character equivalent of … |
The End.