Posts
 
Reputation
Joined
Last Seen
Ranked #4K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
100% Quality Score
Upvotes Received
2
Posts with Upvotes
2
Upvoting Members
1
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
1 Commented Post
0 Endorsements
Ranked #2K
~16.7K People Reached
About Me

#include<stdio.h>

int main(void)
{
printf("No words can describe me ..... ");
main();
return 0;
}

Interests
Sleeping, Googling
PC Specs
P4, 2.8 GHz, 512 MB RAM
Favorite Forums
Favorite Tags
c x 51
c++ x 37

38 Posted Topics

Member Avatar for bossier330

The address of a local variable cannot be returned from a function. I think the problem is with the function [COLOR=blue]char* subArr(char array[65535], int length)[/COLOR] At the end of this function you are returning "temp" which is the starting address of the array temp which is created in this function. …

Member Avatar for iam1sts
0
6K
Member Avatar for vegaseat

A slight modification for the bin2dec function. Removes the nested for loop. Reduces the overhead and removes the temporary variable 'm'. [CODE] int bin2dec(char *bin) { int b , k, n; int len, sum = 0; len = strlen(bin) - 1; for(k = 0; k <= len; k++) { b …

Member Avatar for soorajshaji
0
2K
Member Avatar for kookai

This is one way of going about it without much thinking fn = [ Phi^ n - (-Phi)^-n ] / (2Phi-1) for smaller values of n you need approximation. Phi = ( 5^½ + 1 ) / 2 = 1.6180339 (the golden ratio) ^ = power But this method is …

Member Avatar for Nick Evan
0
2K
Member Avatar for dilip.mathews

Hi all, Can anybody tell me how to calculate the order of a recursive function. Lets take factorial function. Without using recursion [COLOR=blue]int x =1;[/COLOR] [COLOR=blue]for(int i = 1;i<=n;i++)[/COLOR] [COLOR=blue] x = x*i;[/COLOR] In this case the order will the O(n) in terms of time and in terms of space …

Member Avatar for tux4life
0
244
Member Avatar for Ace01000

Hi , I compiled the program in VC and didnt got any error. Its working fine. Only one warning. Thts beacuse u have declared main as "int main (void)" and the main was not returning anything. Just add one "return 0" and the warning will vanish.

Member Avatar for ArkM
0
178
Member Avatar for dilip.mathews

Hi all, Can anybody help me with a an algorithm to find the maximum subset sum in an array. It would be better if the solution is of O(n). [example: {5,-2,10,-4} the maximum is 5 + (-2) + 10 => 13].

Member Avatar for omko
0
1K
Member Avatar for dilip.mathews

I have executed the below programm on both C and C++ compiler and got different results [CODE]#include <stdio.h> int main() { const int a=10; int *p=(int*)(&a); *p = 20; printf("address of a=%u\t%d\n", &a,a); printf("address of p=%u\t%d\n", p,*p); return 0; } [/CODE] With C compiler I got the output address of …

Member Avatar for WolfPack
1
475
Member Avatar for slacke
Member Avatar for slacke
0
116
Member Avatar for dilip.mathews

Hi All, Can we delete this pointer from a member function. I have written three programs to try this. The first two crashes at run time while the third doesn't. Can somebody explain me this????? 1) This crashes at run time. [CODE]#include <iostream> using namespace std; class Base { public: …

Member Avatar for dilip.mathews
0
189
Member Avatar for dilip.mathews

Why cant we have a virtual constructor? All the materials give somewhat similar anwer to this question. "First the VPTR Pointer is initialised to it's proper VTABLE by the contructor which is automatically done by the compiler ,,,," or "You don’t ever want to be able to make a call …

Member Avatar for Laiq Ahmed
0
158
Member Avatar for dilip.mathews
Member Avatar for dilip.mathews

[code]#include <stdio.h> #define a b #define b a int main(void) { int a = 20, b = 30; printf("%d %d", a, b); } [/code] What will be the output of this programm ?????????????? Really confused with this ... Can somebody tell me what exactly will be happen and how macros …

Member Avatar for WaltP
0
228
Member Avatar for comp_sci11
Member Avatar for steve_randle

You should put [CODE]equihrs=equihrs-12;[/CODE] inside this if also [CODE]if(equihrs==12)[/CODE] Other than that I dont see any problems

Member Avatar for steve_randle
0
148
Member Avatar for nlsna17
Member Avatar for Lun

"If a character is a string, change it to an underscore" I guess Dave meant "If a character is a space, change it to an underscore"

Member Avatar for ~s.o.s~
0
102
Member Avatar for dilip.mathews

I have to write a function which takes an integer array as input and it should return true if the array contains 1,2,3 or 4. Conditions 1) The function should pass thru array only once. 2) Can use two local variable. 3) Preferably using bit manipulation. Now suppose if the …

Member Avatar for WolfPack
0
135
Member Avatar for maharba

I hevent gone thru your code ... You can do something like this Random Number % Number chosen == 0 then proceed else choose other random number.

Member Avatar for bkelly
0
104
Member Avatar for krayJ

Modify your MarkNumber as shown below. [CODE]void MarkNumber(int input) { int loop=input ; while (loop >= 10) { cout<<"0123456789"; loop -= 10; } int n = input%10; for(int k = 0;k<n;k++) cout<<k; cout<<endl<<endl; }[/CODE]

Member Avatar for dilip.mathews
0
102
Member Avatar for knorden

I tried running the same code but didnt got any segmentation fault. Just changed the prototype of main and try it

Member Avatar for knorden
0
111
Member Avatar for djkross

[code]void stackLL::push(int value) { Node *temp= new Node; temp->data=value; temp->link=top; top=temp; [COLOR=blue]delete temp;[/COLOR] } [/code] Why are you deleting the memory pointed by temp? top is also pointing to the same location. I think that is causing the problem. I commented that part and compiled. It didnt crash.

Member Avatar for djkross
0
95
Member Avatar for dilip.mathews

[code]#include <iostream> using namespace std; class Exercise { public: int a; Exercise(){cout<<"constructor\n";} Exercise(const Exercise& x) { cout<<"copy constructor\n"; a = x.a; } Exercise& operator= (Exercise &x) { a = x.a; cout<<"assignment operaor\n"; return *this; } }; Exercise fun(Exercise& ); int main(void) { Exercise y; Exercise z; z = fun(y); return …

Member Avatar for WolfPack
0
105
Member Avatar for dilip.mathews

[CODE]void main(void) { char *p = "name"; p[0] = 's'; printf("%s", p); }[/CODE] The above piece [COLOR=black]of code is giving me eror at run time. The reason for this error might be that I am not allocating any memory for the pointer(correct me if I am wrong).[/COLOR] [COLOR=black]My doubt is, …

Member Avatar for dilip.mathews
0
267
Member Avatar for balachandu

You have to sort the array with a O(n) sorting technique. Then search for the duplicated elements . (if nth and (n+1)th elements are same they are duplicated). Delete the elements and copy all the element after it one element backwards. But I think order will increase from n. (not …

Member Avatar for dilip.mathews
0
146
Member Avatar for dilip.mathews

Hi all, What is the effficient way to check whether a single linked list is looped somewhere.The number of nodes in the list is not known. In that case traversal of SLL will go into an infinite loop. One solution I have is to store each address of node in …

Member Avatar for dilip.mathews
0
95
Member Avatar for kraze_101

[code]#include <stdio.h> #include <string.h> int main() { char a[100]; int len, i; printf("Enter the string"); scanf("%s", a); len = strlen(a); for(i=0;i<len;i++) { if((a[i] <= 'm')&&(a[i] >= 'a')) { a[i] = a[i] + 13; } else if((a[i] > 'm')&&(a[i] <= 'z')) { a[i] = a[i] - 13; } } printf("%s", a); …

Member Avatar for ~s.o.s~
0
193
Member Avatar for joydeep1

1. For upadting "r+" can be used. 2. What should be the last character of ur string or how u want ur string to terminate ?

Member Avatar for ~s.o.s~
0
109
Member Avatar for jatinder kumar
Member Avatar for chillharsh
Member Avatar for dilip.mathews
0
89
Member Avatar for jitterson

Y dont u search in web. U can get tons of material related to inheritance. Just give the string "Inheritance tutorials"(google)

Member Avatar for jitterson
0
103
Member Avatar for dilip.mathews

Hi all, I created a string object and printed its size. Its always priniting output as 16. Why is it like that? Can anyone give me idea about how string class is implemented. I am using VC [COLOR=blue]string input; cin>>input; cout<<sizeof(input)<<input<<'\n';[/COLOR]

Member Avatar for Narue
0
121
Member Avatar for Kumal

Try this. #include <iostream> #include <string> using namespace std; This should remove the error in first line and "//getline (cin, input); // Error Given: " 'getline': identifier not found " I dont think functioin get is declared in string or iostream. Thats y its giving undeclared identifier error.

Member Avatar for WolfPack
0
154
Member Avatar for joydeep1

During the first choice how will the file contains data???? The file will not be created at all ...

Member Avatar for joydeep1
0
105
Member Avatar for sgriffiths

What is final_seek_pos??? [COLOR=royalblue]#include <stdio.h>[/COLOR] [COLOR=royalblue]void main() { FILE *fp; char update_record[40] = "STEPHEN"; fp = fopen("test.txt", "rb+" );[/COLOR] [COLOR=royalblue] fseek(fp, 0, SEEK_SET ); fwrite(update_record, sizeof(update_record),1 ,fp );[/COLOR] [COLOR=royalblue] fclose(fp); }[/COLOR] [COLOR=#4169e1][/COLOR] [COLOR=#4169e1]This code is printing STEPHEN for me.[/COLOR]

Member Avatar for sgriffiths
0
162
Member Avatar for ostkaka

Use [COLOR=blue]return 0;[/COLOR] at the end of the program, otherwise compiler will throw warning. Its a good programming practice.

Member Avatar for dilip.mathews
0
79
Member Avatar for nileshdalvi

This is one way of doing it (not so efficient). I am not quite familiar with printf. I believe using printf efficiently the two nested for loops can be removed. Refer some books in C for the usage of printf statement. [CODE]#include <stdio.h> int main() { int i, k, n= …

Member Avatar for dilip.mathews
0
84
Member Avatar for dilip.mathews

Hi, I am bit confused with the concept of pointer to a data member of a class. In the below program what actually will the pointer variable be storing? When i tried printing the value of address I got value 1, Whatt does it mean? [COLOR=blue]class A{ public: int d; …

Member Avatar for dilip.mathews
0
170
Member Avatar for dilip.mathews

Hi Everybody, Myself Dilip over 24 years of age from India, Kerala (Gods own country - atleast some of u might be knowing). Currently working as Software Engineer in Honeywell Tech Sol Lab - India. Topics of intereset - C and Operating Systems. Best Wishes, Dilip Mathews.

Member Avatar for happygeek
0
45

The End.