Talk:Introduction to computing: Difference between revisions
From Applied Science
(Created page with "Changed ''"The concept of pointers to struct is the same as pointer to any other variable"''. I gave the idea that struct is a variable, which contradicts other pages. Struct is a data type and you declare a variable with the type struct. I also changed the ''Note'' about the function that swaps all values of all members of two structs. The way I wrote it makes it very confusiong about what is a pointer, struct and a memory address.") Tag: wikieditor |
No edit summary Tag: wikieditor |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Changed ''"The concept of pointers to struct is the same as pointer to any other variable"''. I gave the idea that struct is a variable, which contradicts other pages. Struct is a data type and you declare a variable with the type struct. I also changed the ''Note'' about the function that swaps all values of all members of two structs. The way I wrote it makes it very confusiong about what is a pointer, struct and a memory address. | == Conditional operator == | ||
* I erased one phrase about the conditional operator. I may have made a confusion betwee trading two commands by one. The conditional operator is a pair of two characters. I may have made a mistake in comparing two keywords with two characters. | |||
== Introduction to functions == | |||
* I made two small mistakes that I only noticed now. The sum of the arithmetic progression requires three variables to work with any sequence, not just 1 + 2 + ... + n. The function was defined as int, which means that if the result was non integer we would lose digits. | |||
* In the last algorithm the sum is an integer, but it's storing the result of a division of two integers. It's losing digits at each iteration. I also changed n from int to float because I think I confused the value of the variable with the value that the function returns. | |||
== Functions, structs and pointers == | |||
* Changed ''"The concept of pointers to struct is the same as pointer to any other variable"''. I gave the idea that struct is a variable, which contradicts other pages. Struct is a data type and you declare a variable with the type struct. I also changed the ''Note'' about the function that swaps all values of all members of two structs. The way I wrote it makes it very confusiong about what is a pointer, struct and a memory address. | |||
== Search and sort == | |||
* Added a short comment about the binary search algorithm. It may happen that someone looks at the table and notice the blank cells. Therefore, one may happen to think that some values from the array were erased. We are just searching, not erasing anything. | |||
== Random numbers == | |||
* After reading again what I wrote about srand() I noticed that I made a mistake in the article about random numbers. How can srand() be of void type and at the same time I told that srand() returns some value? Corrected this confusion. | |||
== Commented exercises == | |||
* In the third algorithm I removed a phrase about the difference beween a program and a function, because it was confusing and not needed. |
Latest revision as of 23:22, 23 January 2025
Conditional operator
- I erased one phrase about the conditional operator. I may have made a confusion betwee trading two commands by one. The conditional operator is a pair of two characters. I may have made a mistake in comparing two keywords with two characters.
Introduction to functions
- I made two small mistakes that I only noticed now. The sum of the arithmetic progression requires three variables to work with any sequence, not just 1 + 2 + ... + n. The function was defined as int, which means that if the result was non integer we would lose digits.
- In the last algorithm the sum is an integer, but it's storing the result of a division of two integers. It's losing digits at each iteration. I also changed n from int to float because I think I confused the value of the variable with the value that the function returns.
Functions, structs and pointers
- Changed "The concept of pointers to struct is the same as pointer to any other variable". I gave the idea that struct is a variable, which contradicts other pages. Struct is a data type and you declare a variable with the type struct. I also changed the Note about the function that swaps all values of all members of two structs. The way I wrote it makes it very confusiong about what is a pointer, struct and a memory address.
Search and sort
- Added a short comment about the binary search algorithm. It may happen that someone looks at the table and notice the blank cells. Therefore, one may happen to think that some values from the array were erased. We are just searching, not erasing anything.
Random numbers
- After reading again what I wrote about srand() I noticed that I made a mistake in the article about random numbers. How can srand() be of void type and at the same time I told that srand() returns some value? Corrected this confusion.
Commented exercises
- In the third algorithm I removed a phrase about the difference beween a program and a function, because it was confusing and not needed.