I can not understand huge pointer, how its working.
#include<stdio.h>/ *How its working &decleration*/
int main(){
int huge *a =(int huge *)0x59990005;
int huge *b =(int huge *)0x59980015;
if(a == b)
printf("power of pointer");
else
printf("power of c");
return 0;
}
I am making a calculator where I will input 5 array of numbers and calculate those numbers with pointers or whatever you call it. I am getting an error like
I’m writing an application for raw image processing but I cannot allocate the necessary block of memory, the following simple code gives me an allocation error.
double (*test)[4]; int block = 32747520; test = new double[block][4];
off course with smaller block size (i.e. int block = 327475;) it works fine. Is there an allocation limit? How it is possible to deal with big blocks of memory?
I have been coding a while on a 2D random terrain game. How would I go about saving the maps? I have an array for blocks, lighting, background and background lighting. The lighting is done in real-time, so exclude that.
But with two 32000x3200 arrays, I still need to store 204800000 separate numbers in a file. Oh god. How can I have this? I could write down the separate numbers, but...yeah.
I want to build a server which holds hundreds of thousands of active users in memory. To keep all the users organized i would like to store them in a Vector.
The problem is how i could quickly and easy find the object whenever i need it? All users will have a unique ID. Would it be possible to keep some form of a Vector Index on the unique id number?
i have a spec for fetch the files from server and predict the un-used files from the directory in this situation i am going to fetch the files from server it will return huge files, the problem is the cpu usage will increase while i am fetching large files, so i like to eliminate this scenario.
I am trying to understand what techiques can be used to sort really huge files (larger than available memory). I did some googling and came across one technique.
1. Are there any better ways to get this done?
2. Is there some tweaking that can be done to make this itself better?
Large enough so that you get a lot of records, but small enough such that it will comfortably fit into memory
3. How do you decide on this value? Consider, memory is 4 GB and currently about 2GB is consumed, and file to sort is 10GB in size. (Consumed memory could of course change dynamically during execution - consumed more/less by other apps.)
I was having problems changing the value of my head node I passed it as an argument as head which would be the address. The parameter was defined as struct node *head. like this
I tried manipultaing pointer values to change head node value but it did not work. I saw some code online which used pointer to pointers(in code below) to change head node value it worked I dont fully understand why. Would like better understanding of why.
Would also like to know why the argument call needed &head instead of just head.
remove = deleteNode(&head,found); opposed to remove = deleteNode(head,found);
I've just started learning from "Jumping into C++". Great book. Unfortunately, I've also encountered my first snag. Practice problem number 3 from chapter 4 tells me to make a small calculator that takes one of the four arithmetic operations and its two arguments as input and give the result as output. Here's what my newbie mind came up with:
Code: #include <iostream> #include <string> using namespace std; int main()
[Code] .....
The thing that I don't get is why doesn't the function "getline" work. It's worked in previous programs. The program seems to work if I simply replace getline with a simple "cin". I could easily use that as a cheap fix but I am interested in knowing why "getline" refuses to work anymore....
I am writing a simple console-based tic-tac-toe game. I am trying to write a function to check whether someone has won the game.
The board data is saved in an array called board: Code: int board[3][3] with each element corresponding either to an empty spot, an X, or an O, using the numbers 0, 1, and 2, respectively. For clarity:
Code: #define EMPTY 0 #define X 1 #define O 2 Here is my function: Code: int check_state(int board[3][3]) { int winner = 0;
I have to write a program to print pascals triangle and stores it in a pointer to a pointer , which I am not entirely sure how to do. I also have to write the file and read it, then create a binary file. Assignment is attached. I am not the best with programming and especially with pointers. I will post my code below.
Code: #include <stdio.h> #include <stdlib.h> void writePascalTriangle(char *fileName, int heightOfTriangle, int **triangle) { FILE *fp; fp=fopen("writePascalTriangle.txt", "w");
I'm making a system like twitter for class called ShoutOut.com I want to be able to get the PublicShoutOut pointer pointed to by the start iterator and assign it to firstShoutOutToDisplay and secondShoutOutToDisplay because I need that in order to pass the pointers to one of my functions. When I step through the debugger the values in start are all default values like "" and so are the values in this->firstShoutOutToDisplay but the message that start points to is being output just fine.
EDIT: got rid of irrelevant code. Am I using the correct syntax to do this?
if (start != finish) { //getting these because a shoutout needs to be passed to the function that displays //options for a shoutout this->firstShoutoutToDisplay = (*start);
const void insertStuff(const void *key, const int value){ // I want to convert the void pointer into one // of three types of pointers(int, string, or double) switch(value){ case 0: int *intPtr = key;
[Code] .....
But this causes an error of: "crosses initialization of int*intPtr"
I just dont see what the issue is here. I have stared at this thing forever. Im trying to make a calendar from scratch so I can be prepared for my second test on Friday.
Code: #include<stdio.h> #include<stdlib.h> int main(void) { int i, n, s;
My question is how strtok will work in the beginning?
According to this to determine the beginning and the end of a token, the function first scans from the starting location for the first character not contained in delimiters (which becomes the beginning of the token). And then scans starting from this beginning of the token for the first character contained in delimiters, which becomes the end of the token. The scan also stops if the terminating null character is found.
This end of the token is automatically replaced by a null-character, and the beginning of the token is returned by the function. strtok will replace the first * with '' and the next call will start from the second * puts '' there and again the same with the third * ?
I am unable to get the string seaching function to work. it always says "Nothing found" I am stumped.
Code:
#include <stdio.h> #include <string.h> char tracks[][80] = { "I left my Heart at Harvard Medical School", "Newark, Newark, You suck balls", "Dancing with a dork", "From Here to maternity", "The Girl from Iwo Jima",
how the -bounds annotations work, and I came up with the following test program.The alloc_char function ensures maxRead/ maxSet(str) == len. This is, in turn, ensured by malloc and memset (see the comments; I found this in /usr/share/splint/lib/standard.h), but SPLint doesn't recognize that.However, SPLint correctly sees that requires maxRead(str) >= i is fulfilled in main.
(Of course the main function is contrived and I could use puts instead, but that's not the point. The point is to make it see that i is not out of bounds.)I have struggled with -bounds for a very long time. Earlier I gave up and used -likelybounds instead. But now I have written a library which is annotated for splint -strict with -likelybounds, and I want people to be able to use it with the full -bounds checks. I can't get those ensures and requires annotations for maxRead/Set to work.
I have a program that spawns a number of threads. Each thread generates a table of output. During the time that it is creating this output, I don't want the other threads to be outputting, so I've attempted to create a mutex semaphore to allow only one thread at time to ouput.
Code:
sem_t mutex; void* node(void *thread_arg) { // set a mutex lock to allow the output for this next step to complete for this thread sem_wait(&mutex); // generate table with various fprintf statements }
puts(pd) does not give any output in the below code. Also, the first puts(ps) does give an output, but the second puts(ps) after "while" does not give any output.
Code:
#include <stdio.h> int main() { char source[50]="Alice has apples."; char destination[60]; char *pd, *ps; }
I want to access the body of the Add() of a list in c# to see how it works, but it only just gives me the declaration.
[DebuggerTypeProxy(typeof (Mscorlib_CollectionDebugView<>))] [DebuggerDisplay("Count = {Count}")] [Serializable] public class List<T> : IList<T>, ICollection<T>, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable { public void Add(T item); // thats all. I tried go to declaration but still gives me this line of code. This is from metadata in Visual studio. }
How this thing work. It just a declaration not a definition yet its still doing something. How is that possible.
#include <iostream> #include <string> using namespace std ; int main() { string bored ; do { cout << " program" <<endl ;
[Code] .....
I made this as a simple do/while program, and if i run it, the second do/while statement will keep on going forever, without the [cin >> bored;] line working?