15,552 Topics

Member Avatar for
Member Avatar for Tinnin

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 …

Member Avatar for Tinnin
0
186
Member Avatar for حسنين_1
Member Avatar for Ancient Dragon
0
117
Member Avatar for ram619

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"); }

Member Avatar for Rahul47
0
511
Member Avatar for Rahul47

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.

Member Avatar for Rahul47
0
124
Member Avatar for nitin1

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.

Member Avatar for rubberman
-1
153
Member Avatar for ram619

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 …

Member Avatar for ram619
0
192
Member Avatar for حسنين_1

how nested esle if statement execute and which statement execute first . give example

Member Avatar for crescendo
0
125
Member Avatar for jony_munsi

// 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; …

Member Avatar for Ancient Dragon
0
155
Member Avatar for jony_munsi
Member Avatar for Gonbe
-4
118
Member Avatar for حسنين_1
Member Avatar for deceptikon
0
82
Member Avatar for jony_munsi

// 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); …

Member Avatar for rubberman
-1
171
Member Avatar for Assembly Guy

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 …

Member Avatar for Assembly Guy
0
390
Member Avatar for حسنين_1

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 .

Member Avatar for ddanbe
-1
124
Member Avatar for sargarpramod

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

Member Avatar for tilakkumar
0
3K
Member Avatar for حسنين_1
Member Avatar for Ancient Dragon
0
87
Member Avatar for jandanielsaclolo

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"... …

Member Avatar for Gonbe
0
227
Member Avatar for حسنين_1

PLEASE TELL ME A THREE DIMENSIONAL ARRAY WITH EXAMPLE . WRITE COMMENT ALSO

Member Avatar for Unimportant
-1
100
Member Avatar for zahidhcy
Member Avatar for Unimportant
0
185
Member Avatar for faysal.ishtiaq_1

/* ############ 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 …

Member Avatar for Unimportant
-1
371
Member Avatar for alaa sam

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

Member Avatar for rubberman
0
121
Member Avatar for Niraj Agarwal

#‎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++){ …

Member Avatar for rubberman
-1
145
Member Avatar for overwraith

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 …

Member Avatar for Unimportant
0
378
Member Avatar for raging_the_fire

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) …

Member Avatar for iamthwee
0
3K
Member Avatar for saurabh.mehta.33234

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 …

Member Avatar for Unimportant
-1
246
Member Avatar for overwraith

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( …

Member Avatar for Unimportant
0
164
Member Avatar for piczim

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 …

Member Avatar for piczim
0
265
Member Avatar for nitin1

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 ? …

Member Avatar for rubberman
-1
704
Member Avatar for Rahul47

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. …

Member Avatar for Adak
0
94
Member Avatar for hg_fs2002

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. …

Member Avatar for Unimportant
0
385
Member Avatar for Rahul47

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

Member Avatar for Rahul47
0
201

The End.