Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
0% Quality Score
Upvotes Received
0
Posts with Upvotes
0
Upvoting Members
0
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
0 Endorsements
~9K People Reached
Favorite Tags
Member Avatar for anumash

Consider a base class that is derived by two sub-classes and a third class derives from the above two classes. I make the base class virtual, so as to not make copies of the base class. My question is that do I have to include the base class constructor in …

Member Avatar for NathanOliver
0
171
Member Avatar for anumash

Hi, I was learning operator overloading and I noticed a very strange thing. I could access the private variable of another object by using the object reference and the . operator. Both the objects belong to the same class and I can alter the value of a private variable of …

Member Avatar for anumash
0
268
Member Avatar for anumash

I am defining a class outside a function and inside a function and returning the address of the object using new to main. I have no problems when the class definition is outside any objects but when I initialize the class definition within a function I am getting errors, this …

Member Avatar for David W
0
206
Member Avatar for anumash

I want to declare an ordinary pointer (not a member pointer) to a member function. I have tried but apparently I am getting errors. Is this allowed in C++? Why is it not? #include<iostream> class A{ private: int m; public: void show(void){ std::cout<<"M= "<<m<<std::endl; } }; int main() { A …

Member Avatar for anumash
0
253
Member Avatar for anumash

I wrote the following program to access an object's private members via its address. How is it possible that the following code did not give me *ANY* error? The code compiles and gives me the right answer. Does this mean C++ is inferior to other languages in its ability to …

Member Avatar for ddanbe
0
275
Member Avatar for anumash

I get the fact that arrays are NOT the same as pointers but when an array is used as an rvalue it is implicitly converted to a pointer. I used the above to write a program to store a 1-D array's address in a pointer variable. Below is my code: …

Member Avatar for tinstaafl
0
273
Member Avatar for anumash

Hello, I am starting out learning Python syntax and in the book that I am reading it is mentioned that objects are assigned by reference and not by value, i.e. foo1=4 foo2=foo1 Now foo2 and foo1 refer to the same object in memory and I even verified this by using …

Member Avatar for megaflo
0
329
Member Avatar for anumash

I am having a confusing time with understanding arrays and variables because of this reasoning: Variables are aliases for memory locations and array name is the address of the first element of the array then why are variables not accesssed as *i whereas the first element of array is accessed …

Member Avatar for Schol-R-LEA
0
154
Member Avatar for anumash

I have the following code: It gives me a segfault when I modify any element in the character string. Why is that? The first two statements print fine but as soon as I modify the value of any element in the character string it gives me an error! I have …

Member Avatar for rubberman
0
275
Member Avatar for anumash

I have just started developing and writing linux kernel modules and device drivers. I am having a lot of trouble understanding new data types that I haven't encountered while writing application programs. For instance, I am having difficulty understanding what is the purpose of size_t, ssize_t, loff_t etc? Why use …

Member Avatar for mike_2000_17
0
245
Member Avatar for anumash

This question refers to the automatic storage class and its scope is defined as local to the block in which the variable is defined and is alive until the control is present in that block where it is defined. Consider these two snippets ... main( ) { auto int i …

Member Avatar for rubberman
0
248
Member Avatar for anumash

Hello all! I am having difficulty understanding why the range of signed integers is from -128 to +127? Assuming the size of the register is 8 bits and the leftmost bit is reserved for sign shouldn't the size be -127 to +127. I figured that for the negative values the …

Member Avatar for anumash
0
212
Member Avatar for anumash

What is this "write protect" and "card present" on the SD card? Are these pins on the SD-card or are they some feature of the SD-card?

Member Avatar for razib8bd
0
92
Member Avatar for anumash

#include<stdio.h> int main(){ char inputs[33]; int i; for(i;i<33;i++) inputs[i]=' '; int ch; for(i=0;(ch=getchar())!=EOF&&i<32&&ch!='\n';i++) {printf("%c",ch); inputs[i]=ch; } inputs[i]='\0'; printf("%s",inputs); return 0; } I am writing a program where the user enters a character and the program stops asking the user for a character when the user enters the Enter key. Enter …

Member Avatar for anumash
0
127
Member Avatar for anumash

I have a .txt file and it contains a word and it's meaning. The word and the meaning are separated by a tab. I am noticing different tab sizes for the words i.e. the no. of white spaces separating the word and the meaning are not same for every entry. …

Member Avatar for gerbil
0
126
Member Avatar for anumash

I have a very confusing question to ask and it is the difference between array of pointers & pointer to an array. I want to understand this concept very well so please please do help me understand this concept. I'll start with what I have understood about array of pointers. …

Member Avatar for anumash
0
163
Member Avatar for anumash

Hi, I was trying to browse through the contents of an SD card containing the FAT16 filesystems using a HEX editor. I was looking up a person's program to navigate through the filesystem i.e. reading the master boot record, boot sector etc and he has used a "long" for fields …

Member Avatar for anumash
0
178
Member Avatar for anumash

I am writing a program to divide my entire database (which comprises of words(A-Z) and phonemic definitions of the corresponding word on the same line) into small text files that become manageable if they are to be read by an 8-bit microcontrolling unit. The database is sorted. Right now at …

Member Avatar for anumash
0
229
Member Avatar for anumash

Is there a way we can decrement a file pointer. I searched online and I found the ungetc() function but what if we want to decrement the file pointer to point to the last string in the database? Also, how does ungetc *put back* a character?? Explain. Thanks in advance!!

Member Avatar for deceptikon
0
300
Member Avatar for anumash

I am trying to open a text file which contains a dictionary of english words. Each word and it's definition are on the same line and the entries are delimited by a newline. Now, my question is that if you open a text file using fopen() in "rt" mode then …

Member Avatar for deceptikon
0
210
Member Avatar for anumash

When we open a new file using the FILE structure and fopen(), the file pointer points to the first byte of the file. How can we know the location of any byte in the file using the file pointer? When I try to store the location of fp (file pointer) …

Member Avatar for anumash
0
185
Member Avatar for anumash

I have to divide a database and I wanted the statistics of each subdirectory that I am going to create. The database is a dictionary comprising of words and their corresponding phonemic translations. https://cmusphinx.svn.sourceforge.net/svnroot/cmusphinx/trunk/cmudict/sphinxdict/cmudict_SPHINX_40 the database can be found here. I have written a program to count the number of …

Member Avatar for deceptikon
0
355
Member Avatar for anumash

I have a lot of problems understanding the concept of size_t and will really appreciate if anybody can help me understand the concept. I searched a lot on the net and went on a multiple forums and answers ranged from "it's an unsigned integer type" to the more bizarre "it …

Member Avatar for deceptikon
0
183
Member Avatar for anumash

I am trying to parse the FAT filesystem & I notice that many of the fields are more than 2 bytes. I was reading someone's program and he has defined unsigned short for a given field of 2 bytes. Now, my question is how does the compiler handle endianness? If …

Member Avatar for rubberman
0
146
Member Avatar for anumash

I have Dev-C++ as an IDE and MinGW as the compiler, and I am running C programs on the IDE. I have this project where I have to write raw PCM data (unsigned 8-bit i.e bytes of PCM) as an array. I have figured out the reading part but when …

Member Avatar for Moschops
0
134
Member Avatar for anumash

I recently wrote a program to determine my current working directory using getcwd(). getcwd() returns the starting address of the character array supplied by the programmer. I have written a very simple program and as I am not an experienced C program can anyone mention what I can do to …

Member Avatar for deceptikon
0
103
Member Avatar for anumash

I was wondering how the compiler searches for a file using just the name of the particular file. The function argument that should be supplied is the file name in double quotes and mode i.e. read, write etc. What if there are two files of the same name but in …

Member Avatar for anumash
0
162
Member Avatar for anumash

I understood that when you pass the name of the array as an argument to a function we are actually passing the base address of the array, which inturn gets collected by a pointer variable and thus s[i]=*(s+i)=*(i+s)=i[s]. The problem begins when we turn to 2-D arrays. When we want …

Member Avatar for anumash
0
177
Member Avatar for anumash

I want to write a program in C that will take a .wav file as an input and will output a C array i.e. raw PCM samples. I know the bitrate and have other information about the .wav file beforehand and I just want the PCM samples. The PCM samples …

Member Avatar for rubberman
0
2K
Member Avatar for anumash

My code compiles successfully but doesn't run why?? What problem whatsoever is with the syntax????? [CODE]import java.util.Scanner; public class uppercase{ public static void main(String args){ Scanner in=new Scanner(System.in); System.out.println("Enter string:"); String str=in.nextLine(); for(int i=0;i<str.length();i++) {if(i!=str.length()-1&&str.charAt(i+1)>='a'&&str.charAt(i+1)<='z'&&str.charAt(i)==' ') { str = Character.toUpperCase(str.charAt(i)) + str.substring(i+1); } } if(str.charAt(0)>='a'&&str.charAt(0)<='z') str = Character.toUpperCase(str.charAt(0)) + str.substring(1); …

Member Avatar for sam.udo
0
146