Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 7539
3 votes
Accepted

Why is this program behaving unexpectedly?

The problem is with your scanf and the fact that you are telling it it will read an int but you give it a char. ASCII values may be represented by integers, but scanf can distinguish them. It checks f …
ChrisG's user avatar
  • 7,396
1 vote
Accepted

Why can't we declare an array dynamically?

Say you want an array of integers, you can do it like that: printf("What is the length of the array? …
ChrisG's user avatar
  • 7,396
1 vote
Accepted

How to iterate through an array using pointers

Yes you are correct. The compiler knows what data type you are using and traverses by the correct amount of bytes every time. You just tell it how many places away from zero you want (by the + i). You …
ChrisG's user avatar
  • 7,396
1 vote
Accepted

2nd Week and 2nd Lecture: Dynamic array

What you want to say, is that the array is immutable, which means once you have declared their length, you can't change it to add more values. … Or when a new student arrives, but your array is full, you can create a new array, with a bigger length, copy all the values you have stored on the first array, and then add the new student. …
ChrisG's user avatar
  • 7,396
1 vote

Array in php vs R (pset7 sell.php)

Just like _POST your positions is an associative array. Just as you get $_POST["symbol"] you get $positions["price"]. If I understood correctly you want to do something like the following <? …
ChrisG's user avatar
  • 7,396
1 vote
Accepted

pset7: why do we need [0] in from of list? (e.g. someData[0]['dic']?)

It's because when you run an SQL query with execute(), all the affected records in the database are returned to you, in an array of dictionaries. So you want the first dictionary in that list. … But if you gave for example a query that returns all users whose name starts with an S, you might want to use the whole array. Hope that helps. …
ChrisG's user avatar
  • 7,396
0 votes

pset2 vigenere shifting characters by the same

A good idea would be to create an array of ints, with the same length as the key, and populate it with the numeric representation of the key. …
ChrisG's user avatar
  • 7,396