Hi all, perhaps someone can shed some light on the following sum:
\lim_{m\rightarrow\infty}\frac{1}{m}\sum_{k=1}^{m-1}\left[1-\left(\frac{k}{2m-k}\right)^{1/2} \right]^2
What particularly throws me off is having the m variable as part of the summands. I have ran numerical simulations...
I've recently started learning about topological insulators. I've read a considerable amount of (review) papers on the subject, yet I still only have a phenomenological understanding of what a topological insulator is. I know for example, that the gapless surface states have to be there because...
In C, why do you have to define a pointer type? For a 32 bit computer, the address is 4 bytes long no matter what, so it shouldn't matter if the pointer is to a char or an int, yet I get a compiler warning when I use a char pointer to point to the address of an int.
Also, I don't quite...
So I'm learning C, and I think I'm doing pretty well so far. Anyway, I'm up to Arrays, and some code that was posted in the tutorial is this:
#include <stdlib.h>
int main()
{
int* myArray = malloc( sizeof(int) * 20 ); // could write int myArray[20]; instead.
myArray[5] =...
I have an original code that searches through "s" for a specific character then stores this into a pointer (otherwise, null). This is the original code:
const char* findMe(const char s[], char c)
{
for (int k = 0; s[k] != 0; k++)
if (s[k] == c)
return...
A lot of scientific programs are CPU-intensive, so speed is important. Pointers have to do with memory management, which I presume is important since there are often so many array values that memory management becomes important. yet, I don't see it used very often. Are they used very often?
#include <stdio.h>
#define K 10
int array1[K], array2[K];
int *ptr;
int addarrays(int x[],int y[]);
main()
{
int count;
for (count = 0;count < K; count++)
{
puts("Enter numbers into array1");
scanf("%d", array1[count]);
}...
Hey all,
I'm taking a physics class dealing with harmonic motion and wave motion, and the last homework assignment of the quarter was given a bit late (i.e. after we began to cover extraneous lectures that are abstract and challenging), so I'm finding it hard to get back into the swing of...
After compiling the code below, GCC says that you can't compare a pointer to string by iso C++ standards.
But I don't see a pointer anywhere (I don't know pointers for now...did it long ago, now forgot)...may be it has to do with the fact that arrays are called by reference.
char...
A long time ago, I was once told that too much reliance on databases in programing can create slow programs. Databases provide a nice way to store and organize information but they may not retrieve and write information quickly. Clearly ram is the fastest way to access meomry but the size of ram...
I am not entirely sure where to post this, please tell me if anything needs to be changed
This is my first post so i'll introduce myself...
My name is Joe, currently aged 17 and in year 13 in school in Kent, Uk doing the International Baccalaureate (Not sure how well known this is? Quite...
Recently, i obtained a 100mW green laser pointer, and the thing gets me confused.
On one side, the beam is bright enough to see from some distance at 90* angle to it, and the point is visible on a hillside some miles away.
On the other hand, it doesn't burn anything, like advertisements often...
I ran across this site from 2001:
http://www.afineline.org/projects/paint.html
Apparently it didn't work very well. Anybody care to guess what kind of equipment it would take to make a red splotch appear on the moon to the naked eye from earth?
Hi I am new using pointers and i am having a hard time trying to figure out how to write a program in c++ using pointers and classes. The program can be used to translate whole dollar amounts in the range 0 through 9999 into an English description of the number. For example, the number 713...
I want to infinitely print a saying to the console but I am not allowed to used iostream.
I am using the function putc. I understand I need to use an infinite loop. So far I have:
int main()
{
char *word;
word = &SAYING[0];
while(true)
{
putc(*word, stdout);
word ++...
Isn't a pointer simply a memory address? Then why is the following illegal?
int x = 1;
char *p = &x;
&x should simply evaluate to an address in memory and that should be stored in the content of p. If this was run on a 32-bit architecture, under ASCII formatting, then
*p = 'a';
Will modify...
in this code i got a chat type pointer which is an array
who consists out of 4 char cells
in order that each pointer cell of this array will point to some place
we need to give it an address some thing like &chr
"Monday morning" is not an address and its not a single char
this...
Okay so I got the majority of my program complete, however when I try to run it it doesn't display the proper value of the average. I think I somehow messed up using my pointers and arrays, but I can't locate the problem and I've spent hours trying to fix it to no avail. see comments for better...
Hi, I was hoping a C++ guru could help me with a problem I'm having using the gnu science library (gsl) in my C++ code. Here is my issue:
Take for instance the Runge Kutter codes for solving differential equations. You need to supply the gsl routines for this a pointer to a function describing...
Mentor note: Long-time member who hasn't been around for a couple years. This is a problem worth investigating, though, IMO.
There was a problem in an assignment I was solving, which asked me to break up the elements of a linked list into 3 different linked lists. Rather than creating 3 linked...
Circular chasing pointers...
Can anyone please point me towards a site that can explain how to implement a dynamic circular chasing pointer array of integers?
Thanks in advance
Hi guys,
***I just started c programming, I've done some reading last week and i came up with a basic program.Ive got a problem trying to assign an input as an adress to a specified value.Basically i have 3 datas in my array and it will be called by inputting a number which points to the...
Hi
I'm currently starting to prepare a 15 min preparation on a chemistry topic.
The topic I have been chosen to do is ''New methods of functionalizing armonatic rings; New methods for the constructing of C-O bonds to functionalize aromatic rings''
Does anyone have some pointers to...
I've tried to implement a list within a class. I did this so that I can make 2 or more objects, where each object has a list as it's member. Here is the code to it:
struct coeffecient {
int num;
int den;
};
struct polynomial {
float power;
coeffecient coeff;
int...
homework help or pointers anyone?
A 1.29-cm-tall object is placed 31.1 cm to the left of a converging lens with a focal length f1 = 20.4 cm. A diverging lens, with a focal length f2 = -42.4 cm, is placed 31.1 cm to the right of the first lens. How tall is the final image of the object?
im...
if i have declared int *p
and afterwards, in the progress of the programme iv'e typed
++p or p++
is there any difference between and what exactly is the difference?
thanks advance.
Homework Statement
I am working on a program that reads in names (strings), sorts them, and then later is searchable. The problem I am having is this. When I enter the first 20 elements of the array, everything works fine. When I enter the 21 element (when it goes into the if loop) I get...
there seem to be no forum for applied math on PF, but can anyone here point me to simplest yet efficient yet not covered by evil patents algorithm for motion detection between two/more consecutive images?
pointers ...C language
I need your help:
name1 < name 2 > name 3
I m writing a problem that place:
a pointer on name 1
a pointer on name 2
a pointer on name 3
I have been working on it more than 24 hours but in vain :cry:
what i did is strcmp with < if it is place ptr 1 (it...
(a) What's the time between 9h and 10h in which the minute and hour pointers are equal? (b) After midday, what's the first time in which the three pointers are equal?
For (a), I tried to do:
\Theta = \Theta_0 + \omega_{hours} \cdot t
\omega = \frac{2 \cdot \pi}{T}
\Theta_0 = 270^o...
Can anyone help me understand the basic use of pointers.
I am aware of pointers,yet I feel that a program can be made more
easier without using a pointer.
My basic dout is that can pointers be used to save memory by dynamic declaration of variables.
I thought over it but found that using...
In my program have a function like this:
void * changeInfo(bool *flag, string *NewName)
{
if (!(*flag))
{
cout << endl << "Enter the new Name: ";
getline(cin, *NewName);
cout << *NewName;
}
}
My problem is reading the input using the pointer to a...
I am working through some exercises and need some help on a couple of questions.
1. Show that in any inner product space X that
B[x;r] = x+rB[X] := \{x+ry\,:\, y\in B[X]\}
where B[X] is the closed unit ball.
2. Show that the closed unit ball is convex.
I have thought about these...
I am not sure I wrote this correctly, but I am trying to declare an array of 12 pointers to arrays of 50 characters:
char *names[12] [50]
Does this look OK? Thanks.
This is the latest assignment I am struggling with:
Write a program that contains a function void shift(char *) that looks at the first character of its argument and converts the other characters, to be the same case, that is, if the first character is uppercase, it shifts the rest to...
I have run into a little bit of confusion working with pointers and I am trying to figure out which of the expressions below from my assignment are valid. My definition of a pointer is that it is a variable that contains a memory address, so I get confused about whether I am modifying a location...
I declare my pointer as char* ptr and my function as public boolean FuncFoo() but java compiler complains that I have some problem with identifier right at * and my function is missing the method body...
I couldn't figure out what was wrong with them. Would you please help me ?
Thank you,