- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 20
- Posts with Upvotes
- 18
- Upvoting Members
- 9
- Downvotes Received
- 6
- Posts with Downvotes
- 6
- Downvoting Members
- 3
hello...m avinash..pursuing my degree in Computer Science and engineering from durgapur,West Bengal,India.I am happy to be a part of daniweb, provides me a good platform to learn and help others.
thanks to daniweb
- Interests
- apart from programing,i play flute & harmonium, i ve als interest in sketching.
- PC Specs
- C and C++. I want to learn them in very depth, but programming is not C/C++/JAVA, it is logic and algo.
82 Posted Topics
Re: You can also use instead- [CODE] int gd=DETECT,gm; initgraph(&gd,&gm,"C:/TC/BGI"); [/CODE] | |
Re: [B]BUBBLE SORT[/B] Algorithm written for bubble sort is completely different. In bubble sort the largest number is in the last position(in case of arranging it in ascending order).,for the first loop j will compare till last and for second i loop j have to compare one loop less because last … | |
Re: Ummmm self refrential structure is basically nothing but referring to a structure of its own type. [CODE] struct node { int data; struct node *next; }; [/CODE] In the code above , a pointer is used . Pointer is used for storing either a valid address or NULL. here next … | |
Hello every one Can I have a better algorithm to find the nth prime number, where 1<= n <=5000000. for e.g., 1st prime number is 2. 10th prime number is 29. 100th prime number is 541. 1000th prime number is 7919. 10000th prime number is 104729. 100000th prime number is … | |
Re: Macros and External Variables are really two different things:- [B]Macros[/B] are preprocessor directive means they are executed before the actual compilation of code begins.They are started with #define. [B]External Variables[/B] are used for declaration of variables(local), they can be defined any where in the programs.By default value stored in global … | |
I am doing following code to get the output upto 5 decimal characters of any number inputted by user when divided by 1, I have to use typecast it with (float) , can any one tell me how this can be done without typecasting or using float constant.. int main() … | |
I want to fetch names and address of all my friends from facebook and store it in my system, Can AnyOne tell me how this can be done with html, php or anything...I don't have any idea for this.. | |
I am a newbie to php and learning now, can you please help me telling how can I take inputs from users in pHp instead of using forms (i.e., a replacement of scanf() in php. I am solving a question to take number as a input and print that number … | |
I ve to sort an array according to finish time and accordingly start time should be arranged, how can we do this using predefined function qsort. Both Start time and finish time, i ve considered it be in a structure , .here is the code.. #include<stdio.h> #include<stdlib.h> int compare (const … | |
Re: I ve gone through the book " LET US C " , there are many loop holes in the book, many wrong writings and incorrect programs in the book.(I am indian, so its a valid statement). You can go through the sticky notes in the site and C Programming by … | |
Re: Watch the pattern carefully and think a bit. First can you code for the pattern:- * ** *** **** | |
Re: its because output screen is not holding, it's displaying output and goes off..you can use scanf("%c",&hold); before return 0 to hold the screen. and carefull don't forget to declare hold variable as char. check this:- [CODE] int main(){ char as; /*your code......... ..................... .......................... ........................... ............................ */ scanf("%c",&as); return 0; … | |
Re: check this line instead:-- [CODE]for(i=3; i<=a/2; i=i+2) [/CODE] it will decrease the time complexity, I have checked this for few numbers and this is working. | |
Re: Think of this:-- Q)Find all divisors of 80. soln:- all divisors of 80 are:- 1,2,4,5,8,10,16,20,40,80 notice the fact:-- it can be written as:-- L.H.S R.H.S 1 * 80 2 * 40 4 * 20 5 * 16 8 * 10 notice LHS elements are less than 9. i.e., sqrt(80)=8.xxx equivalent … | |
Hello everyone I am trying to apply [URL="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes"]Sieve of Eratosthenes[/URL] in program, but its not working. Here is my code:-- [CODE] #include<stdio.h> long long arr[10000]={0}; int main() { long long i,j,num,inc=2,m=0; num=5000; for(i=0;i<num;i++)arr[i]=i; for(i=2;i<=num/2;i++){ if(arr[i]>0) { for(j=inc*i;arr[j]<=num;j=j+i) arr[j]=-1; inc++; } } for(i=0;i<num;i++)printf("%lld ",arr[i]); printf("\n"); return 0; } [/CODE] This code … | |
Re: whenever there is queue, there is fifo rule.. first think what actuatlly happens in a queue, when there is no patient , counter is empty, first position is zero as its last position. when a patient comes starting position as well as last position becomes 1. now when 2nd patient … | |
Re: conclusion of bitwise operator:-- a<<b is equivalent to a*(2^b) and a>>b is equivalent to a/(2^b) | |
Re: Segmentation fault is due to an attempt of access of an area of memory that is not allowed to be accessed. Common causes are:- Improper format control string in printf or scanf statements. Forgetting to use & on the arguments to scanf. Accessing beyond the boundaries of an array. Failure … | |
hello daniweb.. :) I am learning JAVA and currently new to it, I am studying "The Complete Reference-JAVA" by Herbert Schildt. In that book its written that using short or byte will save space, but there is no guarentee that Java won't promote those types into int internal anyway. Remember … | |
Re: structure is good option, you should learn it but array of pointers can also be used.... | |
Re: For [CODE] 1. input = " Mary had a little lamb."; 2. output = "", "", "Mary", "", "had", "a", "little", "lamb."[/CODE] and [CODE] 1. input = "a b- c d"; 2. output = "a", "b-", "", "c", "d"[/CODE] what pattern I am noticing is that:- 1) There is a … | |
Re: your code does n't seems to give right output.. for prime factorization you should search for sqrt(n) method, where n is number whose prime factorization is to be found | |
Re: compzets:- We are not here to check full codes if you are not specifying your problems.what do you want..?? positing the same code doesn't make a clear idea to us again about your problem. [B]SPECIFY YOUR AREA OF PROBLEM[/B] [QUOTE]hey buddy if u r not aware of c programming language … | |
Re: n=4. 2^4= 2 * 2 * 2 * 2; 2 is multiplied four times. You can use a loop from 1 to n to multiply 2 to n times. now % is modulas operator which gives the remainder part i.e, a % b = R as a=b*d + R for … ![]() | |
Re: ironic behaviour of scanf() :-- user have to take 5 input i.e, press 5 y's one by one like that y y y y y [CODE] #include<stdio.h> int main(void) { int i=5; char ans; do { i++; scanf("%c",&ans); }while(ans=='y' || ans=='Y'); printf("%d",i); return 0; } [/CODE] as user will press … | |
Re: What I am analyzing(as Narue told not to do that,but due to curiosity i did) is that, for the parenthesis part a's value is assigned to b, but b outside a is not assigned i.e., it's not containing the value that is done in parenthesis. so it's (b) containing the … | |
Re: A structure is a collection of one or more variable , possibly of different types,grouped together under a single name for convenient handling. For the first time,I am seeing such a use of structure.. Can you please explain me your code. possibly what I understand is, you are trying to … | |
Re: x is always storing some value,for the next do while loop so better you do:- [CODE] int persistence( int input ) { int digit, x , persist = 0; while ( input > 9 ) { [B]x=1;[/B] do { digit = input % 10; x = x * digit; input … | |
Re: [QUOTE]Heres a program I wrote, I'm including this to show how nooby I am in C, I really am a complete begginer :/[/QUOTE] Since you are asking about books only , its not necessary to include these type of sentences and programs to show that you are a beginner , … | |
Re: *(b+n) equivalent to b[n]; *(*(b+n)+j) equivalent to b[n][j]; **b will store the address the address of any pointer or an array. I am little confused with your code...! Can you please explain me what all these thing means..?? | |
Re: yep as told by mike. The user program never sees the real physical address. The program create a pointer to location created by CPU(called virtual or logical address), store it in memory, manipulate it and compare it with other addresses. The memory mapping hardware converts logical addresses to physical address. … | |
Re: dev90: There's mistake in your logic:--it will also not work for N=2,4 i.e, even numbers. because for N=6 when i=0 j=5, i=1,j=4, 1=2,j=3, i=3,j=2, i=4,j=1, i=5 j=1, what is been seen here is that the array elements are swaped twice for the first half half part, array is reversed and … | |
Re: You need to practice questions on loops , first try to solve basic problems patterns and then step up to high level, little practice will make you clear about the ideas of loops and you will visualize the functionality , working and code just by seeing the pattern. Good luck.. | |
Hello..! I am newbie to java and I have got frustrated using notepad, can anyone please suggest me a good compiler for java. I am using Windows 7 as O.S. | |
Re: [QUOTE]if (sumd=7,11)[/QUOTE] line 18,22,26,34, for or operation the condition will be like this:- [CODE]if(sumd==7 || sumd==11)[/CODE] | |
Re: sizeof() is used to calculate the sizes of datatypes, in number of bytes. It returns the size of the type of the variable or parenthesized type-specifier that it precedes as a size_t type value. sizeof can be applied to all datatypes, be they primitive types such as the integer and … | |
Re: 2^5= 2*2*2*2*2; =4*2*2*2 =8*2*2 =16*2 =32 see 2 is decreasing one by one. | |
Re: We are not here for doing any one's homework. You have to write the code on your own. However for the logic part there will be two loops i and j i loop is for row, and j loop is for column. Hope you know about matrix, just figure out … | |
Re: Yup as told by Ancient Dragon, atoi()converts a string into an integer and atof->string to float. Are you trying to do this:--;) [CODE] #include<stdio.h> int main(void) { char a[]="90"; int c; c=atoi(a)/3; printf("%d",c); return 0; } [/CODE] | |
Re: Your code doesn't seems to work in my compiler Dev C++, with or without int n. which compiler are you using.? | |
Re: Yup I think you are stucking in taking input as spaces, since you are using scanf(). | |
Re: Ummmm this is called self refrential structure which is basically nothing but referring to a structure of its own type. [CODE] struct node { int data; struct node *next; }; [/CODE] In the code above , a pointer is used . Pointer is used for storing either a valid address … | |
Re: [QUOTE]int a[10];[/QUOTE] is an array of integers which will store 10 elements and you don't need to store values in different elements. a[0] to a[9] = 10 elements. [QUOTE]for(i=0;i<10;i++)[/QUOTE] basic syntax:-- for(initialization;condtion;increment/decrement) is a loop which start from i=0 till i reaches 10 means the block will execute 10 times … | |
In the book "The Complete Reference-JAVA" by Herbert Schildt. Its written there that "In C/C++, char is an integer type that is 8 bit wide and char in JAVA is a unicode 16 bits wide." I ve understud the point but I want to ask that char in JAVA isn't … | |
In C, array is sequence of variables. int arr[3]; if arr is 2000 then arr+1 is 2000+sizeof(int). lly arr+2 is 2000+2*sizeof(int). in that way array elements are accessed but in JAVA array elements are dynamically allocated using new. then how all others variables are accessed, means I want to ask … | |
hey I am having confusion in the output of a simple program. here is the code:- [CODE] int main(void) { printf("%d %d",sizeof('A'),sizeof("A")); return 0; } [/CODE] output on my compiler(gcc):- 4 2. I thought sizeof("A") is considered as string ending with '\0' so there are two characters i.e,2 bytes a … | |
Re: when You write zero before any decmial number, compiler will automatically convert that number into its octal form , check the code:- [CODE] #include <stdio.h> int main() { printf("%d",057); return 0; } [/CODE] however i tried a lot to understand your code but i cant get why you are using … | |
Re: there are basically 5 data types in C. Int, Char, Float , Double and Void. The type Void either explicitly declares a function as returning no values or creates generic pointers. when we declare [CODE] int i; int *p; p=&i; [/CODE] when we declare p as an integer pointer means … | |
Re: Yup as told by gerard4143 and asit mahato. Saurav:-Don't get confused by seeing negative sign as output. for eg:-- [CODE] main() { int i = 449; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );} [/CODE] output is -> -63 1. As binary of 449 is 00000001 11000001 for 11000001, … | |
Re: i++ is same as i=i+1, and its required as per conditions of program. inbuilt thing unable to get your words. Machine only understand the thing which we perform and follow our instructions. if i=0 then how it will increment automatically as machine is not having any sense until we tell … |
The End.