language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* Michael Weir, Owen Dunn, Anthony Nguyen
* Programming Project 1: Reliable File Transfer over UDP
* Cis 457
* Fall 2018
*
* Client:
* When started, the client asks for the IP address and a port number.
* If valid data is given, the client will then use this information
* to send data. he client then promp... |
C | #include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#define BUFSIZ 1024
int copy(int dst_fd, int src_fd);
int main(int argc, char *argv[]) {
int fd, result;
if(argc == 1) {
result = copy(STDOUT_FILENO, STDIN_FILENO);
if(result < 0) {
return result;
}
return 0;
}
while(--argc) {
... |
C | //TO CHECK WHETHER THE GIVEN NUMBER IS PRIME OR NOT.
#include<stdio.h>
void main()
{
int n,j,count=0;
printf("enter the number : ");
scanf("%d",&n);
for(j=2;j<=n/2;j++)
{
if(n%j==0)
{
count=1;
break;
}
}
if(count==0)
{
printf("given number is a prime ");
}
else
{
printf("given number is not... |
C | #include <stdio.h>
#include <time.h>
#include "rs232/rs232.h"
#include "parser.h"
#include "printer.h"
#include "string.h"
int parser_port = -1;
int get_port_name()
{
clear_screen();
printf("Please enter the name of the serial port you want to use!\n");
char port_name[PORT_NAME_MAX_LEN];
fgets(port_n... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
int main(int argc, char *argv[])
{
int fd = -1; // fd 就是file descriptor,文件描述符
char buf[100] = {0};
char writebuf[20] = "abcd";
int ret = -1;
// 第一步:打开文件
fd = open("123.txt", O_RDWR | O_... |
C | #include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(void) {
int fd[2];
int nbytes;
pid_t cpid;
char base[] = "This is the base string.\n";
char extra[] = "This string should be appended to the base and returned to the parent.\n";
char... |
C | //
// test_can_bus.c
// CCanOpenStack
//
// Created by Timo Jääskeläinen on 20.10.2013.
// Copyright (c) 2013 Timo Jääskeläinen. All rights reserved.
//
#include "test_can_bus.h"
#include "can_bus.h"
#include "log.h"
#include "test_util.h"
/****************************** Local Variables **************************... |
C | #include <stdio.h>
#include <pthread.h>
#include <string.h>
#include <stdlib.h>
// in order to pass multiple arguments to a thread, it is better to create an argument structure
struct thread_data
{
int thread_id;
int sum;
char *message;
};
typedef struct thread_data thread_arg_struct;
void *printHello(void *thread_a... |
C | #include <stdio.h>
#include <cs50.h>
int main(void)
{
// int n;
// do
// {
// n = get_int("width: ");
// }
// while (n < 1);
// //print the question marks 'n' times
// for (int i = 0; i < n; i++)
// {
// printf("?");
// }
// printf("\n");
for (int i... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int a,n,rev=0;
printf("enter the number");
scanf("%d",&n);
while(n!=0)
{
a=n%10;
n=n/10;
rev=rev*10+a;}
printf("%d",rev);
}
|
C | #include <stdio.h>
int main() {
int i;
scanf("%d", &i);
do{
if(i%5==0) {
printf("%d\n", i);
}
i--;
} while (i>=0);
} |
C | /*
* File: 4.10+4.11-PrintStars.c
* ----------------------------
* This program prints 8 rows of stars.
*/
#include <stdio.h>
#include "genlib.h"
#include "simpio.h"
/* constants */
#define rows 8
/* main program */
main()
{
/* 4.10 */
/*
int i, j;
for (i = 0; i < rows; i++) {
for (j = 0; j <= i; j++) ... |
C | #include "a4.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double comp_distance(const PIXEL *A, const PIXEL *B, int image_size) {
double distance = 0;
int i;
for (i = 0; i < image_size; i++) {
distance += (A[i].r - B[i].r) * (A[i].r - B[i].r);
distance += (A[i].g - B[i].g) * (A[i].g - B[i]... |
C | /* ------------------------------------------------------ */
/* FUNCTION dominance_count : */
/* Given two sorted (increasing) arrays, this function */
/* computes the number of pairs that satisfies f[i]>g[j]. */
/* This function is similar to coincidence_count(). */
/* ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "hash_table.h"
#define DEFAULT_NUM_BUCKETS 128
/*
* Returns number of buckets in hash table
* Number of buckets = lowest power of 2 greater than arrLen
*/
int getNumBuckets(int arrLen) {
arrLen--;
int numBuckets = 2;
while(arrLen >>= 1) {
... |
C | #include "comm.h"
int mh_sendto(const char *dest_ipaddr, const char *send_buf, socklen_t send_len)
{
if (NULL==dest_ipaddr || NULL==send_buf || 0==send_len)
{
printf("mh_sendto() - Illegal dest_ipaddr/send_buf/send_len\n");
return -1;
}
SKADDRIN dest_addr;
memset(&dest_addr, 0, sizeof (SKADDRIN));
dest_addr.... |
C | #include <stdio.h>
#include <stdlib.h>
#include "ejercicioUno.h"
float aplicarDescuento(float precio)
{
float retorno = -1;
retorno = precio *0.05;
return retorno;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char **argv) {
long int a = clock();
printf("clock() = %ld\n", a);
return 0;
}
|
C | #include <stdio.h>
int main(){
int a,b;
scanf("%d %d",&a,&b);
if(a<b){
for(int i=a;i<=b;i++){
for(int j=0;j<i;j++){
printf("*");
}
printf("\n");
}
}else{
for(int i=a;i>=b;i--){
for(int j=0;j<i;j++){
... |
C | /*
Приведение типов
Приведение типов работает и между целочисленными типа и числами с плавающей точкой.
Например, если написать так:
int a = 2.6;
То получится, что слева стоит объект типа int, а справа - объект типа double.
Число 2.6 не целое и не может сохранится в числе типа int, поэтом... |
C | #ifndef T_MATRIX_H
#define T_MATRIX_H
#include "tVector.h"
typedef struct {
int capacity;
int n, m;
tVector** matrix;
void* (*defValue)();
void (*tFree)(void*);
} tMatrix;
tMatrix* constructMatrix(int constColumns, void* (*defValue)(), void (*tFree)(void*));
int insertMatrix(tMatrix* mat, void *d... |
C | #include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#define TAMnome 100
#define TAMagenda 1000
typedef struct {
int matricula;
char nome[TAMnome];
int ddd;
int numero;
char tipo;
} TipoAgenda;
void cleanBuffer() {
char cl;
cl = getchar();
while (cl != '\n' && cl != EOF)
cl = getch... |
C | /*
Created by roberto on 29/8/20.
*/
#include "tester.h"
void checkCreateTable(const char * tableName)
/**
* Tester method for createTable which initializes
* a file to store data registers
* @param tableName: file in which data will be stores
* @param tableName: program structure that stores
* a point to the... |
C | #include <stdio.h>
//
int* readArray(int length){
int* array = malloc(length* sizeof(int));
for (int i=0; i<length; i++){
int input;
printf("Enter a element of arrary: ");
scanf("%d", &input);
array[i] = input;
}
return array;
}
void swap(int *xp, int *yp){
int temp = *xp;
*xp = *yp;
*yp... |
C | /*Задача 4. Напишете функция, която връща резултат a*2 + b*c.*/
#include<stdio.h>
double calculation(void);
int main(){
calculation();
return 0;
}
double calculation(void){
double a;
double b;
double c;
printf("Please enter digit a = ");
scanf("%lf", &a);
printf("\nPlease enter a di... |
C | #ifndef MYY_SRC_WIDGETS_WIDGET_AREA_H
#define MYY_SRC_WIDGETS_WIDGET_AREA_H 1
#include "myy/helpers/position.h"
#include "myy/helpers/vector.h"
#include <stdbool.h>
struct widget_area {
position_S upper_left;
position_S bottom_right;
};
typedef struct widget_area widget_area_t;
__attribute__((unused))
static inli... |
C | #include <stdio.h>
void printNaturalNumbers(int lowerLimit, int upperLimit);
int main()
{
int lowerLimit, upperLimit;
printf("Enter lower limit: ");
scanf("%d", &lowerLimit);
printf("Enter upper limit: ");
scanf("%d", &upperLimit);
printf("All natural numbers from %d to %d are: ", lowerLimit... |
C | #include "game.h"
static struct drop_table drop_table[] = {
{90, 1, 10, NULL},
{10, 0, 0, create_random_armor},
{90, 0, 0, create_random_potion},
{0, 0, 0, NULL},
};
struct creature *create_bat()
{
int rc;
struct creature *bat;
bat = calloc(1, sizeof(*bat));
assert(bat);
bat->color = BLUE;
bat->symbol... |
C | /*
Title: Pointer Test
Author: Haider Ali Punjabi
Mail: me@haideralipunjabi.com
Date: 12-07-2018
*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int var;
int* ptr;
var = 3;
ptr = &var;
printf("Value of var before change = %d\n", var);
printf("Address of var before change = %u\n", ptr);
... |
C | #include "functions.h"
#include <math.h>
inline double sigmoid(double x)
{
return (double)1/((double)1+(double)exp(-x));
}
double sigmoidExt(double x,int type)
{
/*0: ֵ 1:*/
if (type == FUNC_VALUE) {
return (double)1/((double)1+(double)exp(-x));
} else {
return (x) * ((double)1-x);
}
}
... |
C | #include <stdio.h>
#include "printSea.c"
#include "check.c"
#include "populate.c"
//a ship can go over the left or right border and reappear
//on the right or left border, respectively,
//because the sea has to be considered as a cylinder
//A ship cannot go from the upper border to the lower border, for the sa... |
C | #include <stdio.h>
#include <cs50.h>
#include <math.h>
int main (void)
{
// Prompt user for $$ amount
float f;
int coins;
do
{
f = get_float("How much $$: ");
}
while (f < 0);
coins = (int)round(f*100);
int counter_quarters;
// Tallies number of quarters used
if (... |
C | #include<stdio.h>
void main()
{
int m, n, i, p, flag = 0;
printf("Enter a Number: ");
scanf("%d", &n);
m = n/2;
for (i = 2; i <= m; i++)
{
if (n%i == 0)
{
printf("%d is not a Prime Number",n);
printf("\n %d times %d is %d" ,i, n/i, n);
flag ... |
C | #include <stdlib.h>
#include "holberton.h"
/**
* string_nconcat - function to concatenate 2 strings
* @s1: first string
* @s2: second string
* @n: first n bytes of second string
* Return: s
*/
char *string_nconcat(char *s1, char *s2, unsigned int n)
{
char *s3;
unsigned int len1, len2;
if (s1 == NULL)
s1 = "";
i... |
C | #ifndef _PREDICATE_H
#define _PREDICATE_H
#include "arch.h"
/* Compare two 64-bit words in constant-time */
#define CMP_LT_U64(a,b) \
(((((a)>>63U)^((b)>>63U)) &((((a)>>63U)-((b)>>63U))>>63U))\
^ ((((a)>>63U)^((b)>>63U)^ONE64)\
&((((a)&((uint64_t)0x7FFFFFFFFFFFFFFF))\
-((b)&((... |
C | /**
** Вариант 41.
** Имеется матрица A размера n на m, состоящая из слов (в качестве элементов матрицы).
** Необходимо найти строку k матрицы A, такую что обращенное слово R(W(k)) совпадает с некоторым из слов W(i), i=0,...,n-1.
** А затем "прибавить" её ко всем остальным строкам матрицы, исключая её саму.
** "Сложени... |
C | #include "test.h"
#include <memory.h>
#define _4bitstoascii(a) (a<10?a+48:a+55)
#ifdef BIG_ENDIAN
#error implement printHex
#else
static wchar_t* printHex(reg_t x, wchar_t * buffer)
{
const int s = sizeof(reg_t);
wchar_t * buffercopy = buffer;
unsigned char const * const c = (unsigned char const * const)(&x);
... |
C | //
// main.c
// baodaotanxianDFS
//
// Created by mingyue on 2022/4/23.
// Copyright © 2022 Gmingyue. All rights reserved.
//
/**
10 10 6 8
1 2 1 0 0 0 0 0 2 3
3 0 2 0 1 2 1 0 1 2
4 0 1 0 1 2 3 2 0 1
3 2 0 0 0 1 2 4 0 0
0 0 0 0 0 0 1 5 3 0
0 1 2 1 0 1 5 4 3 0
0 1 2 3 1 3 6 2 1 0
0 0 3 4 8 9 7 5 0 0
0 0 0 8 7 8 6 0... |
C | #include "monty.h"
void (*get_function(char *s))
{
instruction_t functions[] = {
{"push", push},
{"pall", pall},
/*{"pint", pint},
{"pop", pop},
{"swap", swap},
{"add", add},
{"nop", nop},*/
{NULL,... |
C | /*Demo pre and post decrememt of unary operator*/
#include <stdio.h>
int main()
{
int a = 5;
int b = 5;
printf("Post decrement %d pre decrement %d\n", a--, --b);
printf("Post decrement %d pre decrement %d\n", a--, --b);
printf("Post decrement %d pre decrement %d\n", a--, --b);
... |
C | /* Author Giuseppe Quartarone mat.: 408661
* Implementazione di un albero binario
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "tree.h"
#define DEBUG fprintf(stderr,"%s\n","eccomi")
#define ABORT_1 "out of memory on malloc()"
#define MACRO(x,y) if( x == NULL ){ fprintf(stderr,"%s\n",y);... |
C | /*************************************************************************************
* MIT License *
* *
* Copyright (C) 2017 Charly Lamothe, Doulkifouli Abdallah-... |
C | /*
Creator: Oleg Kryachun
Date: 02/14/2019
Programming Assignment 3
CSE 222
Summary: This program implements a stack and queue with linked lists. The user can switch between stacks and queue,
they can push, pop, or print numbers from the stack and queue. At the end of the program the memory is freed and program exits.... |
C | /**
* @file List.h
* @brief Creation of a generic (simply linked) List structure.
*
* To create a list, one must provide two functions (one function to
* compare / order elements, one function to display them). Unlike arrays,
* indices begins with 1.
*/
#ifndef __List_H
#define __List_H
#include <stdlib.h>
#in... |
C | #include <stdio.h>
#include <string.h>
#include "Pilha.h"
#include "PilhaOperador.h"
#include "PilhaOperando.h"
double calculadora(double num1, double num2, char op);
int ehOperador(char carac);
int ehOperando(char carac);
int main() {
double num1, num2, result;
char str[100], op;
PilhaOperando* pilhaO... |
C | /**********************************************************************************************************************
* FILE DESCRIPTION
* -----------------------------------------------------------------------------------------------------------------*/
/** \file Port.c
* \brief Port driver
*
... |
C | #include <stdio.h>
#include <string.h>
void palindromeDetactor(int n){
while (n--) {
char s[10005];
int prev_ans = 0;
scanf("%s" , s);
for(int i = 0; i < strlen(s); i++){
int j = 0;
int count_odd = 1;
int count_even = ... |
C | #include <stdio.h>
#include <stdlib.h>
#define CELULA_X 1
#define CELULA_Y 2
#define CELULA_NADA 0
typedef struct tabuleiro{
int dados[9];
}t_tabuleiro;
t_tabuleiro cria_tabuleiro(){
int i;
t_tabuleiro tab;
for(i = 0; i< 9; i++){
tab.dados[i] = CELULA_NADA;
}
return tab... |
C | /*
** EPITECH PROJECT, 2019
** libmy
** File description:
** \nHello -> \0AHello
*/
#include "my.h"
void showstr(char const *str)
{
for (int i = 0; str[i] != '\0'; i++) {
if (str[i] < '!' || str[i] > '~') {
my_putchar('\\');
if (str[i] < 16) {
my_putchar('0');
... |
C | #include<stdio.h>
int main()
{
int i,j,m,n;
int mat[10][10];
printf("enter the num of rows:");
scanf("%d",&m);
printf("enter the num of columns:");
scanf("%d",&n);
printf("enter the elements of your matrix\n");
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
prin... |
C | #include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
struct foo {
int a;
char b;
long c;
struct rcu_head rcu;
};
DEFINE_SPINLOCK(foo_mutex);
struct foo __rcu *gbl_foo;
void foo_update_a(int new_a)
{
struct foo *new_fp;
struct foo *old_fp;
new_fp = kmalloc(sizeof(*new_fp), GFP_KERNEL);
s... |
C | /*compile-errors:*/
/*compile-result:1*/
/*save-event:compile*/
#include<stdio.h>
int main()
{
int year;
scanf("%d",&year);//accepting input
if(year%4==0)//checking divisibility by 4
{/*divisible by 4*/
if(year%100==0)
{/*divisible by 100*/
if(year%400==0)
{/*div... |
C |
/**************************************************************************************************/
/* Copyright (C) mc2lab.com, SSE@USTC, 2014-2015 */
/* */
/* FILE NAME ... |
C | /**
*
* @file recuperaInfoR.c
*
* @brief Código que recuera la información de los recursos, crea un cola de ellos
* @author AAFR
*/
#include "cac3.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int recuperaInfoRC(char * sarchivo);
void liberaR(PRecurso pr);
PRecurso creaR(int... |
C | #include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
mode_t sixFourFour();
/*
* FILE* fdopen(int fd, const char *mode);
*/
int main(int argc, char** argv)
{
if(argc != 2)
{
fprintf(stderr, "usage: ./fdopen <path>\n");
return 1;
}
int fd = open(argv[1], O_RDWR | O_CREAT,... |
C | /*
Encoder Card Interface.
Sends commands (RF) via encoder card.
Ported to QNX 4.01 3/31/92 by Eil.
*/
#include <assert.h>
#include <conio.h>
#include <i86.h>
#include <sounds.h>
#define CMD_DISCRETE 0
#define CMD_DATA_LSB 0x40
#define CMD_DATA_MSB 0x80
void strobe(unsigned int address, unsigned int data, int mod... |
C | #include <winsock2.h>
#include <stdio.h>
#define PORT 1355
#define LEN 256
int main ()
{
WSADATA wsaData;
SOCKET ss;
sockaddr_in in,from;
char buf[LEN] = {0};
int namelen, len;
WSAStartup(MAKEWORD(2,2), &wsaData);
ss = socket(AF_INET, SOCK_DGRAM, 0);
memset (&in, 0, sizeof(in));
in.sin_family = AF_INET;
in... |
C | /*
** EPITECH PROJECT, 2019
** my_strdup.c
** File description:
** Dups a string
*/
#include <stdlib.h>
#include "libmy.h"
char *my_strdup(char *src)
{
char *dest = malloc(sizeof(char) * my_strlen(src) + 1);
if (dest == NULL)
return (NULL);
my_strcpy(dest, src);
return (dest);
} |
C |
int printMatrix (float (*arrin), int dimx,int dimy){
int n = 0;
int m = 0;
for (n = 0; n < dimx ; n++){
for (m = 0 ; m < dimy ; m++){
printf("%8.3f ",arrin[dimy*n+m]);
}
printf("\n");
} return 0;
}
int ge_fw(float *matrix , int row, int col,float *matrix_out){
int w = 0;
int i = 0;
int smal... |
C | #include "Header files/mesh.h"
#include "Header files/matrix.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
vertex* meshNewVertex(mesh* M, float x, float y, float z) {
// Luo uuden verteksin (pisteen avaruudessa) ja liittää sen malliin.
// Tarkistaa, että malli ei ole tyhj... |
C | /*
二つの値を交換する関数形式マクロ
*/
#include<stdio.h>
//(* ここに解答を書き加える *)
#define swap(type, a,b) {type t; t = a; a = b; b = t;}
int main(void)
{
int na,nb;
puts("二つの整数を入力せよ.");
printf("整数A:"); scanf("%d", &na);
printf("整数B:"); scanf("%d", &nb);
swap(int, na, nb);
puts("\nAとBの値を交換");
printf("整数A=%d\n", na);
pri... |
C | #include <fcntl.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
unsigned int len = 0;
/*
1.用户输入数据
2.将输入数据保存至 file_1.txt
3.用户输入复制数据长度
4.将用户指定长度的数据从 file_1.txt 复制到 file_2.txt
*/
int main(void)
{
char file_name1[10] =... |
C | /// Obstacle (header)
/// (c) 2017 Jani Nykänen
#ifndef __OBSTACLE__
#define __OBSTACLE__
#include "../engine/sprite.h"
#include "../engine/vector.h"
#include "player.h"
#include "stdbool.h"
/// Obstacle object
typedef struct
{
float x; /// X coordinate
float y; /// Y coordinate
VEC2 speed; /// Speed
... |
C | /*******************************************************************************
* Filename: file_utils.c
* Author: Maxwell Goldberg
* Last Modified: 03.17.17
* Description: Provides utilities for validating plain/ciphertext and key text
* files.
********************************************... |
C | #include <stdio.h>
#include <string.h>
void main()
{
int deptno, id;
char ch;
printf("Enter the id");
scanf("%d", &id);
printf("Enter the deptNo");
scanf("%d",&deptno);
printf("Enter designation code");
scanf("%c",&ch);
ch=getchar();
printf("Employee with employee id %d",id);
... |
C | #include <stdio.h>
#include <math.h>
int main()
{
int p,q,z;
printf("Enter an Number & Power: ");
scanf("%d %d",&p,&q);
z= pow(p,q);
printf("%d",z);
}
|
C | #ifndef FILESYS_INODE_H
#define FILESYS_INODE_H
#include <stdbool.h>
#include "filesys/off_t.h"
#include "devices/block.h"
#include "threads/synch.h"
typedef struct buffer_block {
void* data;
bool free;
bool dirty;
bool accessed;
block_sector_t sector;
struct lock lock;
} buffer_block;
void buffer_init(v... |
C | #include "common.h"
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
int main(void)
{
DIR *pdir = NULL;
struct dirent *p = NULL;
pdir = opendir(".");
if(pdir == NULL)
err_sys("opendir error");
p = readdir(pdir);
while(p != NULL)
{
printf("%s ", p->d_name);
struct stat st;
if(stat(p->d_nam... |
C | /******************************************************************************
* Filename: getAllMedicine.c
* Author: 雷瑞祺
* License: MIT License
* Purpose: handle get all medicine http request
******************************************************************************/
#include "database.h"
#include <stdi... |
C | /*
* Migrated to Discover: Ta Quang Trung
* Date: Nov 08, 2020
*/
#include "discover.h"
int* x,y;
void f(int *m){
__assert_must_alias(m,&y);
int *n;
if(y==1){
n=&y;
f(n);
}
}
int main(){
x=&y;
f(x);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
/* Thing to Research */
int main(int argc, char* agrv[]) {
char address[] = "172.17.0.1";
// Creating a Socket
int network_socket;
// socket(domain of socket (... |
C | #include "delay.h"
// 10ms for 12Mhz
void Delay10mS(INT16U cnt)
{
while(cnt--)
{
Delay1mS(10);
}
}
// 1ms for 12Mhz
void Delay1mS(INT16U cnt)
{
INT16U i;
while(cnt--)
{
for(i = 0;i < 705;i ++)
{
asm("nop");
asm("nop");
asm("nop");
asm("nop");
as... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint8_t BYTE;
BYTE buffer[512] = {0};
int main(int argc, char *argv[])
{
//check for correct usage
if (argc != 2)
{
fprintf(stderr, "Usage: recover filename\n");
return 1;
}
//save file name
char *infile = arg... |
C | #include<stdio.h>
int main()
{
int a = 3;
int b = 5;
if(a>0)
printf("3\n");
else
printf("5");
return 0;
} |
C | /* Author: lmborba */
#include <stdio.h>
#include <stdlib.h>
typedef struct TURTLE {
int nt;
char nome[256];
} turtle;
typedef struct LIST {
turtle * turtl;
struct LIST * next;
} lturtle;
void inserelista(turtle ** turt, lturtle ** lturt) {
lturtle * aux;
aux = (lturtle *) malloc(sizeof(lturtle));
au... |
C | /*
// Sample code to perform I/O:
#include <stdio.h>
int main(){
int num;
scanf("%d", &num); // Reading input from STDIN
printf("Input number is %d.\n", num); // Writing output to STDOUT
}
// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
*/
// W... |
C | /**
* Projekt: Implementace interpretu imperativního jazyka IFJ14
*/
/**
* @file parserexpression.c
* @author Martin Nosek (xnosek10)
* @brief Zdrojový soubor pro parsovaní výrazu
*/
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "parser.h"
#include "parserexpression.h"
#include "globalv... |
C | #include <conio.h>
#include <stdio.h>
#include <math.h>
int main () {
float x, fx, y, fy, z, a, a1, a2, a3;
printf("enter x, y and z\n");
printf("x: ");
scanf("%f", &fx);
printf("y: ");
scanf("%f", &y);
printf("z: ");
scanf("%f", &fy);
x = fx*pow(10, -2);
y = fy*pow(10, 3);
a1 = pow(2, -x);
a2 = ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 2
int main()
{
FILE *fp1, *fp2;
int buf[MAX] = {10, 15};
fp1 = fopen("pap1.txt","w+");
fp2 = fopen("pap2.txt","w+");
fprintf(fp2,"%d%d",10,15);
fwrite(buf,MAX,2,fp1);
fclose(fp1);
fclose(fp2);
return 0;
}
|
C | #include <stdio.h>
int main(){
float x;
for (x=0;x<=10;x++){
printf("%-3f | ",x);
}
puts("\n--------------------------------------------");
for (x=0;x<=10;x++){
printf("%+-3f | ",1/x);
}}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
int* intrev(int* src, int slen){
int* dst = src;
int left = 0;
int right = slen - 1;
while(left <= right){
int tmp = src[left];
src[left] = src[right];
src[right] = tmp;
left++;
right--;
}
return dst;
}
int* plusOne(int* digits, int digitsSize, int... |
C | #include <stdio.h>
void points (double x, double y, double u, double v, double a, double b) {
double m1 = (y-v)/(x-u);
double m2 = (y-b)/(x-a);
if (m1-m2 < 1e-3) {
printf(">>Points lie on the same line\n");
}
else {
printf(">> Points don't lie on the same line\n");
}
}
int main() {
double x;
d... |
C | #include <raylib.h>
#include <stdlib.h>
#include <math.h>
#define NUM_OF_RAYS 1080
#define MAX_STEPS 50
#define FRAMERATE 6000
typedef struct RayMarch
{
Vector2 pos;
float distance;
float angle;
} RayMarch;
typedef struct Sphere
{
Vector2 pos;
float radius;
} Sphere;
typedef struct Plane
{
fl... |
C | #include "sort.h"
/**
* counting_sort - Counting sort implementation.
* @array: Array to sort.
* @size: Array's size.
*/
void counting_sort(int *array, size_t size)
{
int max = 0, i, total = 0;
int *count_array = NULL, *copy_array = NULL;
if (!array || size <= 1)
return;
for (i = 0; i < (int)size; i++)
if... |
C | /** @file
* UART packet-based driver
*
* Recieve commands as simple byte-oriented packets. The first byte indicates the
* length of the command to receieve, rest is the payload.
*
* Can be trivially extended with address byte as the first byte to make a simple
* bus protocol that can handle upto 256 devices.
*
... |
C | #include <stdio.h>
/**
* 위치 탐색 알고리즘 순차적 실행으로 검색
* 인자값
* ar[] = 탐색을 원하는 배열 입력
* len = 배열의 길이
* target = 찾고 싶은 값
*/
int LSearch(int ar[], int len, int target){
/** for문의 실행 횟수를 구하기 위한 값 찾고 싶은 값의 위치 값이 된다. */
int i;
/** 순차적 검색 */
for(i = 0; i < len; i++){
/** 배열의 값 비교 */
if(ar[i]... |
C | #include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <mpi.h>
// Cartesian to linear
#define to_lin(r, c, w) r * w + c
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#ifndef redis
#define redis redistribute3
#endif
//#define rpri... |
C | #include "holberton.h"
#include <stdlib.h>
#include <stdio.h>
/**
* _strlen - length of string
*
*@str: pointer to a string
*
* Return: int, length
*/
int _strlen(char *str)
{
int i = 0;
while (str[i] != '\0')
i++;
return (i);
}
/**
* argstostr - concatenates all the arguments of the program
*
* @ac: in... |
C | // Street of the Merchants, Verhedin
// Thorn@ShadowGate
// 001027
// New City, Verhedin
#include <std.h>
#include "/d/tsarven/include/southern.h"
#include "/d/verhedin/include/city.h"
inherit ROOM;
void create() {
room::create();
set_light(2);
set_short("%^BOLD%^YELLOW%^Street of the Merchants, Verhedin%^RESE... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
int main()
{
int becoan;
for(becoan = 1; becoan <= 33; becoan++){
printf("The becoan is avaliable %d times \n\n", becoan);
}
float black;
for(black = 5; black <= 22; black++){
printf("The black monster is coming %.2f rou... |
C | /*
* wytar.c
* Lucas Manker
* 3/7/20
* COSC 3750
* Homework 6
*
* mimics tar
*/
#include<stdio.h>
#include<tar.h>
#include "wytar.h"
#include<stdlib.h>
#include<unistd.h>
#include<dirent.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<pwd.h>
#include<grp.h>
#include<time.h>
struct tar_header* makeHeade... |
C | #include <stdio.h>
int main (void)
{
int integer = 42;
float singlePrecision = 2.2;
double doublePrecision = 3.31223344556677;
char singleChar = 'J';
printf("your int: %d cast to a float: %f \n", integer , (float)integer);
printf("your int: %d cast to a char: %c \n", integer, (char)integer);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
bool isZero (double value);
int solveLinear(double a, double b, double* root);
int solveQuadratic(double a, double b, double c, double* root1, double* root2);
int testQuad(double a, double b, double c, int num, double root1, double root2);
int testLin(do... |
C | #include "BlueTooth.h"
/**************************************************************************
ߣī˹Ƽ
ҵԱС꣺https://moebius.taobao.com/
**************************************************************************/
#define MAXQSIZE 32
int QueueSize;
LinkQueue *Uart_Queue;
#define bufferLenth 50
extern char uartbuffer[b... |
C | #include <stdio.h>
#include <stdlib.h>
/* Board is an 8-element array of ints, organize 0-based indexes
* like this:
*
* 0 1 2
* 3 4 5
* 6 7 8
*
*/
int winning_triads[8][3] = {
{0,1,2}, {3,4,5}, {6,7,8},
{0,3,6}, {1,4,7}, {2,5,8},
{0,4,8}, {2,4,6}
};
int find_winner(int board[]); /* if c... |
C | /**
* @brief It defines a player
*
* @file player.h
* @author David Ramirez
* @version 1.0
* @date 08/02/2019
*/
#ifndef PLAYER_H
#define PLAYER_H
#include "types.h"
typedef struct _Player Player;
Player* player_create(Id id);
STATUS player_destroy(Player* player);
STATUS player_set_name(P... |
C | #include <stdio.h>
int main(void)
{
int n, m;
scanf("%d %d", &n, &m);
int a[m];
for (int i = 0; i < m; i++)
{
scanf("%d", &a[i]);
n -= a[i];
}
if (n < 0)
{
n = -1;
}
printf("%d\n", n);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
/*Faa um programa que leia a idade de uma pessoa expressa em anos, meses e dias e escreva a idade
dessa pessoa expressa apenas em dias. Con... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char* argv[]){
int pfd[2];
if(pipe(pfd) < 0){
perror("pipe");
exit(1);
}
pid_t pid;
if((pid = fork()) < 0){
perror("fork");
exit(1);
}
if(pid > 0){ // 父进程
close(pfd[1]);
int ret;
char buf[256];
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
void main( )
{
char c[128];
int a,b;
srand(time(NULL)); // 乱数の準備
while ( 1 )
{
printf("\n*******サイコロを振ります。*******\n0を入力すると終了します。\n好きな数字を入力してください: ");
gets(c); a=atoi(c);
if ( a==0 ) break;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.