15,552 Topics
| |
Hi All, I've just started to learn C from "The C Programming Language" (Kernighan). One of the exercises asks you to write function that folds a line of text into newlines after x number of characters without splitting a word. This is my attempt so far: // fold: folds the … | |
Hello, the output of this code is 'ef' but if we add up a "newline" print after this print then the output becomes 'efd'. Then why in earlier scenerio the 'd' was not getting printed ? Thanks in advance. #include<stdio.h> int main() { printf("\nab\bcd\ref"); } | |
| Recently while solving one thread I was stuck with following problem. Am getting two different outputs for same code. One was executed on my machine and another one on codepad.com. Anyone with any suggestion why this might be happening ? Codepad.com's Output ![7316aa7bc992df41bee38de22b55db18](/attachments/large/4/7316aa7bc992df41bee38de22b55db18.jpg "7316aa7bc992df41bee38de22b55db18") My Machine's Output ![ac76eff29302f4b2d1466525c3675909](/attachments/large/4/ac76eff29302f4b2d1466525c3675909.jpg "ac76eff29302f4b2d1466525c3675909") Thanx. |
Code 1 : for(i=0; i<1000; i++) for(j=0; j<100; j++) x = y; Code 2 : for(i=0; i<100; i++) for(j=0; j<1000; j++) x = y; thanks. | |
Hello, This code is from "Test Your C Skills" Book. In the book they have mentioned that this code won't work, and thats true. But I am not able to understand, why its not working. Please explain why it gives error. #include<stdio.h> #define SWAP(a,b,c) c t;t=a;a=b;b=t; int main() { float … | |
how nested esle if statement execute and which statement execute first . give example | |
// stringpattern.cpp : Defines the entry point for the console applic #include<stdio.h> #include<stdlib.h> #include<conio.h> void find_subset(char *set, char *subset,int n, int k, int j); int main() { //FILE *fd; int n,k=0,i; char set[100], subset[100],ch; ch='A'; printf("Enter length of the set:"); scanf("%d",&n); printf("Enter the set:"); for (i = 0; i <n; … | |
please some body give me the full C code of water jug problem | |
// stringprint.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "mpi.h" #include<stdio.h> #include<stdlib.h> int _tmain(int argc, char* argv[]) { MPI_Status status; int numtasks, rank, rc; char ch; rc = MPI_Init(&argc,&argv); if (rc != MPI_SUCCESS) { printf ("Error starting MPI program. Terminating.\n"); MPI_Abort(MPI_COMM_WORLD, rc); } MPI_Comm_size(MPI_COMM_WORLD,&numtasks); … | |
For fun, I want to write my own image format. I'm going to have to draw pixels to a Window, but I haven't found any nice, simple, light librarys that can do this. I've thought about using OpenGL, but it's kind of messy and over-complicated to write code for and … | |
1*2*3*4*5*6=620 i right a program and its output 620 means the facturial of 6 using recursion. i could not uderstand factorial using recursion. please help me . | |
Plz..guys i want to know is there any function that can give ASCII value of character? and do i need to use any header file to use that function | |
Hi there, I'm just new to programming and C++ ... I have trouble with my code At first I am using "int" for variables but then I realize that i need a much larger range of numbers and also support for decimal operations so I change all "int" to "float"... … | |
PLEASE TELL ME A THREE DIMENSIONAL ARRAY WITH EXAMPLE . WRITE COMMENT ALSO | |
/* ############ Project Name : TIC TAC TOE ############ CODED BY ############ > Faysal Ishtiaq Rabby ############ ~ Student ID : 120909 ############ Khulna University, Bangladesh. */ #include "stdafx.h" #include<stdlib.h> int main() /* Declaring Variables */ char gamestart; char pos_input[]={'1','2','3','4','5','6','7','8','9'}; int gameloop, option_position,input,flag=0,player_number,rand_int,i; /* Variable Declaration Finished*/ printf("Press \"ENTER\" to … | |
hey I'm thinking about implementing a simle scan tool , to show the available wireless networks and some information about it . I'm thinking about writing it in C . Is it a good choice?? what libraries do I need to impelement it ?? Thanks in advance | |
#include <stdio.h> #include <conio.h> #include <malloc.h> #define MAX1 5 #define MAX2 7 int* arr; int* create (int size){ int *arr,i; arr = (int *)malloc (sizeof(int)* size);/*note here size of (int )*size means size of int size no. of times, size is the no of integers in the array*/ for (i=0;i<size;i++){ … | |
How do I create a function that accepts by refrence an array of character pointers? I need to be able to overwrite the contents of an array of character pointers, hence I need a pointer to that array. Here is some of my code, but it is throwing errors, so … | |
Been stuck on this for bloody ages. Seems like no easy way to do it! Would appricate some help, thanks! #include <stdio.h> #include <stdlib.h> #include <time.h> char (char *s, const int len) { { static const char alphanum[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; "123456789"; for (int i = 0; i < len; ++i) … | |
The foll code gives o/p as 2310103 28 Now my doubt is why here 10 is printed two times although i m passing t=6 for the d parameter?? #include <stdio.h> #include <string.h> int f(int a, int b, int c,int d,int e) { printf("%d%d%d%d%d \n",a,b,c,d,e); return a+b+c+d+e; } main() { int … | |
Hello, I got some code from: http://stackoverflow.com/questions/1859201/add-seconds-to-a-date this is the code: #include <time.h> #include <stdio.h> int main() { time_t now = time( NULL); struct tm now_tm = *localtime( &now); struct tm then_tm = now_tm; then_tm.tm_sec += 50; // add 50 seconds to the time mktime( &then_tm); // normalize it printf( … | |
I have recently started learning to program in c. I have written a very basic program its a currency converter. I would like to know how to put an icon into my program so when its on the desktop it looks nice. I am sure there are more important things … | |
I was looking for the find and replace algorithm which editor softwares are using. for ex: notepad. when i search something and then when i replace it , how exactly it works. I am aware of rabin-karp and KMP algos. but i am wondering if they are most efficient ? … | |
| Hi folks, I recently started using lcc compiler for C, and am having diffculty in compiling and executing my programs.Each time I make a new file using File --> New --> File, I am not able to compile current file. The previous file which was opened gets compiled and exectued. … |
I would like to know how is it possible to pass registers as function arguments in C. Let's say I have something like this: int main() { register a,b; a = b; register c = a; return 0; } I want to extract a = b as a new function. … | |
| A friend of mine dazzeled me with by asking to write "Architecture for Client-Server in C". As I am noive in C I didnt got his question. I don't expected a prepared recipe but I want to learn the idea what he actually meant. Please Suggest. Thanx |
The End.